Feature #8868
Feature #7538: art service/module command-line helpers
Feature #8770: Implement parameter set validation - task 3a of issue #7538
Feature #8773: Create new types in FHiCL that automatically register allowed parameters.
Develop key map for automatic registration of FHiCL types
Scope:
Internal
Experiment:
-
SSI Package:
FHiCL
Description
Here is a complicated FHiCL that utilizes the different kinds of structures that FHiCL supports:
pset: {
flag: false
tuple: [ 4, "some string", 6.5 ]
vecOfVecs: [ [0,2], [4,5] ]
funSeq: [ [ 1., 2. ], true, 2 ]
tableSequence: [
{ a: "p1"
b: ["s1","s2" ]
tableSequence2: [
{ c: one },
{ c: two }
]
},
{ a: "p2"
b: ["s3","s4" ]
tableSequence2: [
{ c: three },
{ c: four }
]
}
]
pset2: {
test: this
}
}
With the C++ FHiCL types, the above configuration could be supported with the following declaration in a user's source code:
//============================================================================
// Job configuration
//
struct PSet2 {
Atom<std::string> test { Key("test") };
};
struct Test {
Atom<int> value { Key("c") };
};
struct ForRootInput {
Atom<std::string> primary { Key("a") };
Sequence<std::string> secondaries { Key("b") };
Sequence< Table<Test> > tablesequence2 { Key("tableSequence2") };
};
struct Configuration {
Atom<bool> flag { Key("flag") };
Tuple<int,std::string,double> tup { Key("tuple") };
Sequence< Sequence<int> > vecOfVecs { Key("vecOfVecs") };
Tuple< Sequence<double,2>, bool, int> funSeq { Key("funSeq") };
Sequence< Table<ForRootInput>,2 > tablesequence { Key("tableSequence") };
Table<PSet2> pset2 { Key("pset2")};
};
In order to provide a meaningful reference, the system must be able to register the following keys for validation of a parameter set:
pset pset.flag pset.tuple pset.tuple[0] pset.tuple[1] pset.tuple[2] pset.vecOfVecs pset.vecOfVecs[*0] pset.vecOfVecs[*0][*0] pset.funSeq pset.funSeq[0] pset.funSeq[0][0] pset.funSeq[0][1] pset.funSeq[1] pset.funSeq[2] pset.tableSequence pset.tableSequence[0] pset.tableSequence[0].a pset.tableSequence[0].b pset.tableSequence[0].b[*0] pset.tableSequence[0].tableSequence2 pset.tableSequence[0].tableSequence2[*0] pset.tableSequence[0].tableSequence2[*0].c pset.tableSequence[1] pset.tableSequence[1].a pset.tableSequence[1].b pset.tableSequence[1].b[*0] pset.tableSequence[1].tableSequence2 pset.tableSequence[1].tableSequence2[*0] pset.tableSequence[1].tableSequence2[*0].c pset.pset2 pset.pset2.test
where the
[*0]
represent placeholder indices for Sequence<T>
objects, which can have an arbitrary number of elements. This will facilitate easier matching against the parameter set.
Related issues
History
#1 Updated by Kyle Knoepfel over 5 years ago
The implementation of this feature is nearly complete. Support for Tuple< ..., Table<>, ... >
objects needs to be ensured.
#2 Updated by Kyle Knoepfel over 5 years ago
- Blocks Feature #8869: Produce string-rendered version of allowed ParameterSet added
#3 Updated by Kyle Knoepfel over 5 years ago
- Estimated time changed from 16.00 h to 50.00 h
#4 Updated by Kyle Knoepfel over 5 years ago
- Blocks Feature #8870: Create parameter checking algorithm against FHiCL reference added
#5 Updated by Kyle Knoepfel over 5 years ago
- Blocks Feature #8872: Set and retrieve values from FHiCL using new C++ types added
#6 Updated by Kyle Knoepfel over 5 years ago
- % Done changed from 80 to 100
I have verified that the following 21 types produce on construction the correct FHiCL key map:
// In what follows, âTâ represents a type supported by an Atom<>
// and âSâ represents an explicitly constructed struct that may
// contain Atom<>, Sequence<>, Tuple<>, or Table<> objects.
1] Atom<T>;
2] Sequence<T> // Does not support empty Sequence<T> default -- might resolve with issue #8872.
3] Sequence<T,SZ>
4] Tuple<T...> // where the expanded parameter pack represents template arguments that are supported by Atom<>
5] Tuple< Sequence<T>, U...>
6] Tuple< Sequence<T,SZ>, U...>
7] Tuple< Tuple<T...>,U...>
8] Sequence< Tuple<T...> >
9] Sequence< Tuple<T...>, SZ >
10] Sequence< Sequence<T> >
11] Sequence< Sequence<T,SZ> >
12] Sequence< Sequence<T>, SZ >
13] Sequence< Sequence<T,SZ>, SZ >
// 14-21 cannot support default arguments (since Table<> cannot have a default)
14] Table<S>
15] Sequence< Table<S> >
16] Sequence< Table<S>, SZ >
17] Tuple< Table<S>, U... >
18] Tuple< Sequence< Table<S> >, U... >
19] Tuple< Sequence< Table<S>, SZ>, U... >
20] Sequence< Tuple< Table<S>, U... > >
21] Sequence< Tuple< Table<S>, U... >, SZ>
Will mark as resolved once the full code suite is pushed.
#7 Updated by Kyle Knoepfel over 5 years ago
- Status changed from Assigned to Resolved
Pushed to repository with commit fhicl-cpp:36dcfbccdb0d127855fc25838fef209dd042103f.
#8 Updated by Kyle Knoepfel over 5 years ago
- Target version changed from 1.18.00 to 1.16.00
#9 Updated by Christopher Green over 5 years ago
- Status changed from Resolved to Closed