Skip to content

Exercise 3c: Macros

The submit description file supports the use of various macros. When using regular expresions, the following two macros are useful:

$Fn{filename}  is the basename of filename without the file name extension
$Fp{filename}  is the directory portion of filename with a trailing slash
$Fx{filename}  is the file name extension
$Fpn{filename} is filename without the file name extension
$Fnx{filename} is the basename of filename with the file name extension
Create the following submit description file and submit the jobs.

    executable              = $(filename)
    arguments               = $Fnx(filename)
    output                  = $Fpn(filename).$(ClusterId).$(ProcId).out
    error                   = $Fpn(filename).$(ClusterId).$(ProcId).err
    log                     = $Fp(filename)/$(ClusterID).log

    queue filename matching (ex03_folder/*.sh)

Note: As the variable $Fpn(filename) includes the path prefix, the output files will be transferred back to the ex03_folder. If the path prefix is not included e.g. $Fn(filename), then the output files will be transferred to the current working directory (the directory that submission took place).

    executable              = $(filename)
    arguments               = $Fnx(filename)
    output                  = $Fn(filename).$(ClusterId).$(ProcId).out
    error                   = $Fn(filename).$(ClusterId).$(ProcId).err
    log                     = $(ClusterID).log

    queue filename matching (ex03_folder/*.sh)

Last update: November 26, 2019