queue 10 {endcode} -Simple math can use $$([]), in which case you'll use ProcId instead of $(Process). For example, this passes two arguments, the first starts a 1 and increases by 1 for each job, the second starts at 0 and increases by 2 for each job: +As of HTCondor 8.3.5 you can do simple math in the submit file using $INT() or $REAL(). The technique is to use a temporary variable to declare the mathematical expressions, and then refer to the temporary variable using the $INT() or $REAL() macro expansion to evaluate and print the result. The $INT() and $REAL() expansions take an optional argument to control the formatting of the result. + +{code} +executable = myprogram.exe +tmp1 = $(Process) + 1 +tmp2 = $(Process) * 2.0 +arguments = $INT(tmp1) $REAL(tmp2,%.3f) +queue 10 +{endcode} + +Prior to 8.3.5 you can do math by using the deferred expansion of +$$([]), in which case you'll use $(ProcId) instead of $(Process). For example, this passes two arguments, the first starts a 1 and increases by 1 for each job, the second starts at 0 and increases by 2 for each job: {code} executable = myprogram.exe @@ -18,6 +29,26 @@ queue 10 {endcode} +{section: Selection from a list} +In versions of HTCondor starting with 8.3.5, you can use the Process variable to select an item from a list using the $CHOICE() macro. + +In this example, there will be 6 jobs submitted, the first will have arguments=Alan, the second will have arguments=Betty, etc. + +{code} +executable = myprogram.exe +arguments = $CHOICE(Process, Alan, Betty, Claire, Dan, Eva, Frank) +queue 6 +{endcode} + +The list can also be a submit variable like this. This example produces the same resulting jobs as the above example. + +{code} +executable = myprogram.exe +arguments = $CHOICE(Process, Names) +Names = Alan, Betty, Claire, John, Harry, Sally +queue 6 +{endcode} + {section: Random selection} If you want each job to have a randomly assigned argument, you can use $RANDOM_CHOICE. The random selection is not guaranteed to be cryptographically strong, nor necessarily suitable for scientific use. @@ -30,9 +61,9 @@ queue 10 {endcode} -{section: Permute a list} +{section: Permute a list (pre 8.3.5 method)} -If you want to permute some other element, you can use $$([ ]) to evalute arbitrary ClassAd expressions. This is particularly useful combined with lists. If you wanted to permute the 3 names, you could do this: +Prior to 8.3.5 If you want to permute some other element, you can use $$([ ]) to evalute arbitrary ClassAd expressions. This is particularly useful combined with lists. If you wanted to permute the 3 names, you could do this: {code} executable = myprogram.exe