Advanced Jobclass for ADE Jobs

In the directory $VOVDIR/etc/jobclass/examples you can find an advanced jobclass for ADE jobs called spectre_ade.tcl. To deploy this jobclass you can do this:

% cd `nc cmd vovserverdir -p jobclass`
% cp $VOVDIR/etc/jobclass/examples/spectre_ade.tcl.
% vi spectre_ade.tcl 

File: spectre_ade.tcl

# Original Documentation about MMSIM.
set MMSIMDOC {

Simulator solver        RF      turbo   parasitics level         tokens
--------- -----------   ------- ------  ---------  -------      ---------
Spectre   Spectre       N       N       N       spectre L       1
          Spectre       N       Y       N       spectre XL      2
          Spectre       N       N       Y       spectre GXL     4
          Spectre       N       Y       Y       spectre GXL     4
SpectreRF Spectre       Y       N       N       spectre XL      2
          Spectre       Y       N       Y       spectre GXL     4
          Spectre       Y       Y       N       spectre GXL     4
          Spectre       Y       Y       Y       spectre GXL     4
Ultrasim  Ultrasim      N/A     N/A     N       Ultrasim L      4
          Ultrasim      N/A     N/A     Y       Ultrasim XL     6
AMS       Spectre       N/A     N       N       AMS+Spectre L   3
          Spectre       N/A     Y       N       AMS+Spectre XL  4
          Spectre       N/A     N       Y       AMS+Spectre GXL 6
          Spectre       N/A     Y       Y       AMS+Spectre GXL 6
          Ultrasim      N/A     N/A     N       AMS+Ultrasim L  6
          Ultrasim      N/A     N/A     Y       AMS+Ultrasim XL 8 

AMS-APS:  4 tokens + number of tokens in chart below.

Basically the AMS mmsim token # equals 2 + mmsim (spectre L/XL/GXL, or usim L/XL) tokens

In MMSIM 7.2 APS licensing using 90003 is:

1-4 Cores takes 4 tokens.
5-16 Cores take 6 tokens.
APS-RF takes 6 tokens.

APS was released in MMSIM7.1 (and not available in MMSIM7.0).  
If you are using MMSIM 7.1, the licensing for APS using 90002 tokens is this:

APS   #Elements  #Threads     #Tokens
    <=75K        1-4        4 tokens (see Note 1)
    <=75K        5-8        8 tokens (see Note 2)
     >75K        1-4        8 tokens (see Note 3)
     >75K        5-8        12 tokens (see Note 4) 

Note 1: APS L license OR APS XL license OR 4 tokens
Note 2: 2 APS L licenses OR APS XL license OR 8 tokens
Note 3: APS XL license OR 8 tokens(2 APS L licenses not allowed)
Note 4: APS XL+L license OR 2 APS XL licenses OR 12 tokens (2 APS L licenses not allowed)

The APS license process is (MMSIM 7.1):

1. The APS L license or 4 tokens are checked out since circuit size is unknown
2. Once the circuit size is detected, APS L license or 4 tokens are checked in, and the 
   appropriate license/number of tokens is checked out.

}

proc checkRunCommand {{file "runCommand"}} {
    # This procedure examines the runCommand file created by ADE
    # and tries to compute the number of license tokens needed.

    # It is important to be correct so that we do not
    #  - reduce throughput by queueing jobs when licenses are available
    #  - cause license errors by launching jobs when no licenses available

    # Examples of what we may expect in the runCommand file.
    # The \ indicates that the content is all on one line

    # spectre input.ics +iscchars +log ../psf/spectre.out  -format sst2 -raw \
                                                #   ../psf +turbo +lqtimeout 0 -maxw 5 -maxn 5 +lsuspend +lqt 0 +lqs 30

    # spectre input.scs +escchars +log ../psf/spectre.out  -format sst2 -raw \
                                                #   ../psf +aps +lqtimeout 0 -maxw 5 -maxn 5 +lsuspend

    global VOV_JOB_DESC
    # Use a variable for the (long) license name
    # IMPORTANT: change this if you use a non-default name for MMSIM license
    set lictok "License:Virtuoso_Multi_mode_Simulation"

    # Initialize flags
    set hasRF    0
    set hasTurbo 0
    set hasAPS   0
    set tool    ""
    set threadNum 1
    set hasRunCommand 0

    if { [file exists $file] } {
        if { [catch {set ifp [open $file "r"] } opnmsg] } {
            # complain, but do not return, fall into default case below
            VovError "opening run-cmd file '$file'  -- $opnmsg"
        } else {
            set cmd [read $ifp]
            catch {close $ifp}
            set hasRunCommand 1 
            set tool [shift cmd] ; # usually 'spectre'
            # examine the arguments
            while { $cmd != {} } {
                set a [shift cmd]
                switch -glob -- $a {
                    "++aps" -
                    "+aps"   { set hasAPS   1 }
                    "-aps"   { set hasAPS   0 }
                    "+turbo" { set hasTurbo 1 }
                    "-turbo" { set hasTurbo 0 }
                    "+multithread=*" { set threadNum [string range $a 13 end] }
                    "+mt=*"          { set threadNum [string range $a  4 end] }
                    "-multithread" - "-mt" { set threadNum 1 }
                }
            }
        }
    } else {
        VovMessage "run-cmd file does not exist -- '$file'" 3
    }

    # For now, we only cover the spectre case (below, handy line for cut/paste)
    ##### License:Virtuoso_APS_MMSIM_Lk#6 
    ##### License:Virtuoso_Multi_mode_Simulation#6 

    # Do not print this - confuses the interface code
    # puts "$hasRF-$hasTurbo-$hasAPS"

    # compute base number of tokens
    switch -glob "$hasRF-$hasTurbo-$hasAPS" {
        "*-*-1" -
        "1-1-0" {
            set tok_base 2
        }
        "1-0-0" -
        "0-1-0" {
            set tok_base 1
        }
        "0-0-0" -
        default {
            set tok_base 1
        }
    }

    if { $threadNum > 16 } {
        # We do not have doc about this case.  Should check with Cadence
        set tok_core 6
    } elseif { $threadNum >= 5 } {
        set tok_core 6
    } elseif { $threadNum >= 2 } {
        set tok_core 2
    } else {
        if { $hasAPS } {
            set tok_core 4
        } else {
            set tok_core 1
        }
    }
    set tok_tot [expr $tok_base + $tok_core]
    # license resource
    set    VOV_JOB_DESC(fstokens)  $tok_tot
    append VOV_JOB_DESC(resources) " ${lictok}\#$tok_tot "
    # CORES resource
    append VOV_JOB_DESC(resources) " CORES/$threadNum "

    append  VOV_JOB_DESC(resources) " Limit:spectre3_ade#$tok_tot"          ;# Limit for the whole job class.
    append  VOV_JOB_DESC(resources) " Limit:spectre3_ade_@USER@#$tok_tot"   ;# Limit for each user in this job class.
    return $hasRunCommand
}
###
### A jobclass for the jobs generated by Cadence ADE
###

set classDescription "Cadence ADE jobs"

# Use snapshot env for now, but we recommend using composite named environment.
set VOV_JOB_DESC(env)       "SNAPSHOT"
set VOV_JOB_DESC(group)     "/class/spectre_ade"
set VOV_JOB_DESC(legalExit) "0-137"
set VOV_JOB_DESC(priority,sched)  8
# set VOV_JOB_DESC(env)    "BASE+CADENCE"

# following is equivalent to -D on the command line
append  VOV_JOB_DESC(check,directory) 0

# check old and new command file names
set cmdfiles {"runSimulation" "runCommand"}
foreach cfn $cmdfiles {
    if { [file readable $cfn] } {
        break
    }
}

set hasRunCommand [checkRunCommand $cfn]

if { $hasRunCommand } {
    # nothing 
} else {
    # This slave resource is to limit a host to one virtuoso
    #01jul2016 abb; comment out for now
    #append  VOV_JOB_DESC(resources) " virtuoso/1 "
}

##append  VOV_JOB_DESC(resources) " x86_64 RAM/200";   ## Other hardware requirements.
# parray VOV_JOB_DESC

proc initJobClass {} {
    vtk_resourcemap_set       Limit:spectre3_ade            24 
    vtk_resourcemap_set_limit Limit:spectre3_ade_@USER@     16
}
Warning: This is our best attempt to capture the number of tokens used by the various ADE tools, based on the command line in the ICRP scripts. Since Cadence may change their policies on tokens at any time, you may want to adapt the jobclass to your needs.ed by Altair Accelerator as a networkable directory. This may happen if it is on a non-exported filesystem, for example /tmp. To use Altair Accelerator well, the simulation run directories should be on networkable filesystems.