~ubuntu-branches/debian/stretch/adios/stretch

« back to all changes in this revision

Viewing changes to .pc/python3.patch/utils/skel/lib/skel_params.py

  • Committer: Package Import Robot
  • Author(s): Alastair McKinstry
  • Date: 2014-06-16 23:06:38 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20140616230638-5a0z7ylxx8i0edrg
Tags: 1.7.0-1
* New upstream release.
* Add adios.pc pkgconfig file. adios_config now uses this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
                parents=[parent_parser],
15
15
                formatter_class=argparse.RawDescriptionHelpFormatter,
16
16
                prog='skel',
17
 
                add_help=False,
 
17
                #add_help=False,
18
18
                description='''\
19
19
        skel params
20
20
            create a parameter file to define skeletal application behavior''')
21
21
 
 
22
    parser.add_argument ('project', metavar='project', help='Name of the skel project')
22
23
    parser.add_argument ('-g', '--group', help='adios group')
23
24
    parser.add_argument ('-b', '--bpls', help='file containing bpls output')
24
25
 
28
29
    return parser.parse_args()
29
30
 
30
31
 
31
 
def generate_param_file_with_args (config, parent_parser):
 
32
def generate_param_file_with_args (parent_parser):
32
33
    args = pparse_command_line (parent_parser)
33
 
    
 
34
   
 
35
    try:
 
36
        config = adios.adiosConfig (args.project + '_skel.xml')
 
37
    except (IOError):
 
38
        print "XXError reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first."
 
39
        return 1
 
40
 
 
41
 
34
42
    outfilename = args.project + '_params.xml'
35
43
 
36
44
    # Only proceed if outfilename does not already exist, or if -f was used
38
46
        print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename
39
47
        return 999
40
48
 
 
49
    try:
 
50
        config = adios.adiosConfig (args.project + '_skel.xml')
 
51
    except (IOError):
 
52
        print "Error reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first."
 
53
        return 1
 
54
 
41
55
    generate_param_file (args.project, outfilename, config, args.group, args.bpls)
42
56
 
43
57
 
76
90
 
77
91
        for var in group.get_vars():
78
92
            if var.is_scalar():
79
 
 
80
 
                scalar_value = None
81
 
 
82
 
                first_use_name, first_use_dim_num = var.find_first_use () # Get the name and dimension number of the first array that uses this scalar, or None if it is not used
83
 
                if first_use_name is not None:
84
 
                    dims = bpdata.get_dims (first_use_name)
85
 
                    if dims is None:
86
 
                        # Try adding a leading slash to deal with the way that bpls reports variable names without one
87
 
                        dims = bpdata.get_dims ("/%s" % first_use_name)
88
 
                    if dims is not None:
89
 
                        scalar_value = dims[first_use_dim_num]
 
93
                if bplsfile is None:
 
94
                    all_scalars.add ('\n    <scalar name="' + var.get_name() + '" type="' + var.get_type() + '" value="128" />')
 
95
                else:
 
96
                    scalar_value = None
 
97
 
 
98
                    first_use_name, first_use_dim_num = var.find_first_use () # Get the name and dimension number of the first array that uses this scalar, or None if it is not used
 
99
                    if first_use_name is not None:
 
100
                        dims = bpdata.get_dims (first_use_name)
 
101
                        if dims is None:
 
102
                            # Try adding a leading slash to deal with the way that bpls reports variable names without one
 
103
                            dims = bpdata.get_dims ("/%s" % first_use_name)
 
104
                        if dims is not None:
 
105
                            scalar_value = dims[first_use_dim_num]
90
106
                    
91
107
 
92
 
                if scalar_value is None:
93
 
                    scalar_value = 0 # Should be used only for variables that do not appear in any array dimensions
 
108
                    if scalar_value is None:
 
109
                        scalar_value = 0 # Should be used only for variables that do not appear in any array dimensions
94
110
 
95
 
                all_scalars.add ('\n    <scalar name="' + var.get_name() + '" type="' + var.get_type() + '" value="%s" />' % scalar_value)
 
111
                    all_scalars.add ('\n    <scalar name="' + var.get_name() + '" type="' + var.get_type() + '" value="%s" />' % scalar_value)
96
112
            else:
97
113
                dims = var.get_dimensions()
98
114
                dim_str ='dims="'