Computing : Dynamic Conditions during job starts

How can you make a job more dynamic, so that during the start of the job on the node, you can switch between different options? (actually, not during the actual start of the job on the node, but during the assignment of a node to your job)

Let's say, you want to run two different binaries of yours

  • one build if you have a modern CPU, that supports the AVX2 instruction set
  • and another binary, for running on nodes without AVX2

you could of course submit two sets of jobs, one with requiring AVX2 with the `has_avx2` class ad - and another one not requiring it. While it might work, you might just want to submit one batch of jobs and choose the binary depending on what node your jobs get.


To do so, you can use in your submit file the $$([]) expansion

executable = $$([ifThenElse(has_avx2==True, "/nfs/dust/.../MYDIR/is_avx2.binary", "/nfs/dust/.../MYDIR/nope_avx2.binary")])

the `$$()` denotes, that the expression is evaluated during matching a job to a compute slot on a node and theĀ  `[ ]` inside marks a class ad to parse.