Languages

CommunityCategory: MODELZENHow to run MODELZEN via distributed servers such as LSF and SGE

MODELZEN

How to run MODELZEN via distributed servers such as LSF and SGE

SA Support Team Staff 2020-10-21

MODELZEN itself launches a set of SPICE simulations to characterize the devices contained in the circuit. In my company, all SPICE simulations are launched via an LSF queue, which assigns each simulation job to the remote machine with the least workload for load balancing. To let MODELZEN do the same, I added the proper 'bsub' command and options to the simulator commands defined in the technology configuration file as shown below:

# command statements
sim_cmd['hspice'] = lambda deck, log, outdir: ['bsub', '-q', 'QUEUE', '-Is', 'hspice', '-i', deck, '-o', log]
sim_cmd['spectre'] = lambda deck, log, outdir: ['bsub', '-q', 'QUEUE', '-Is', 'spectre', '-f', 'psfascii', '=l', log, '-outdir', outdir, deck]
sim_cmd['finesim'] = lambda deck, log, outdir: ['bsub', '-q', 'QUEUE', '-Is', 'finesim', '-spice', deck, '-log', log, '-out', outdir+'/']

Here, the '-q QUEUE' option submits the job to a queue named "QUEUE" where this name QUEUE may vary depending on the specific LSF configuration. The '-Is' option launches the job in an interactive mode, waiting until the submitted job is finished. I have actually added a few more bsub options to the command (e.g. '-R' option), but they are omitted here for brevity.

MODELZEN runs successfully this way, but one problem is that each SPICE simulation job launched by MODELZEN has to wait a certain time in the job queue, which significantly increases the total run time of MODELZEN launching about 1,000 SPICE simulations. Is there a better way to run MODELZEN via LSF?

1 Answers
Best Answer
SA Support Team Staff 2020-10-21

You made a very keen observation! As you precisely noted, letting MODELZEN run its individual SPICE simulations via LSF can significantly increase the total runtime. Considering that each SPICE simulation launched by MODELZEN is typically a very simple DC or AC simulation completing in a split second, MODELZEN is spending most of the time just waiting for the LSF queue to assign the jobs.

A more efficient way is to launch MODELZEN itself as a job to LSF. This way, MODELZEN is initiated on the LSF-assigned remote machine, and it can launch a set of SPICE simulations on that remote machine without having to wait in the queue again. It is easy to anticipate the amount of resources used by MODELZEN since you can control the maximum number of concurrent SPICE simulations being run by using the '--thread' option on the command line or by setting the devo_options['thread'] option in the technology configuration file.

On the command line, you can launch MODELZEN via LSF using the 'bsub' command. An example is shown below. Please note that you now need to remove the 'bsub' commands from the sim_cmd[...] options in your technology configuration file.

$ bsub -q QUEUE -Is modelzen netlist -c tech_config.py -o model.sv

If you want GLISTER to launch MODELZEN via LSF, you can add these lines after the XMODEL/GLISTER context file (xmodel.cxt) is loaded in the .cdsinit initialization file.

xmodelMODELZEN = "bsub -q QUEUE -Is $XMODEL_HOME/bin/modelzen"
modelzenRunMode = 'batch_bg

These lines define two SKILL variables: the first line sets the xmodelMODELZEN variable to modify the shell command GLISTER uses to launch MODELZEN and the second line sets the modelzenRunMode variable to launch MODELZEN in a background batch mode. It is necessary to switch MODELZEN into a batch mode because LSF blocks the skillIn and skillOut channels used by the default interactive mode for exchanging messages. The background batch mode ('batch_bg) tries to recover the same look-and-feel of the interactive mode.

MODELZEN

LSF와 SGE 같은 분산서버를 통해 MODELZEN을 실행시키는 방법

SA Support Team Staff 2020-10-21

MODELZEN은 회로에 담긴 각 소자들의 특성을 추출하기 위해 일련의 SPICE 시뮬레이션을 실행합니다. 제 회사에서는 모든 SPICE 시뮬레이션을 LSF를 통해 실행하는데, 이는 로드 밸런싱을 위해 각 시뮬레이션을 현 시점에 로드가 가장 적은 원격머신에 할당해서 실행시키는 시스템입니다. MODELZEN도 같은 방식으로 SPICE 시뮬레이션들을 실행시킬 수 있도록, 저는 아래에 보인 것처럼 technology configuration 파일에 정의된 시뮬레이터 명령들에 'bsub' 명령과 적절한 옵션들을 추가해 주었습니다.

# command statements
sim_cmd['hspice'] = lambda deck, log, outdir: ['bsub', '-q', 'QUEUE', '-Is', 'hspice', '-i', deck, '-o', log]
sim_cmd['spectre'] = lambda deck, log, outdir: ['bsub', '-q', 'QUEUE', '-Is', 'spectre', '-f', 'psfascii', '=l', log, '-outdir', outdir, deck]
sim_cmd['finesim'] = lambda deck, log, outdir: ['bsub', '-q', 'QUEUE', '-Is', 'finesim', '-spice', deck, '-log', log, '-out', outdir+'/']

참고로, 여기서 쓰인 '-q QUEUE' 옵션은 "QUEUE"라는 이름의 대기열에 job을 제출하라는 옵션인데, 대기열의 특정 이름은 LSF 셋업에 따라 다를 수 있습니다. 그리고 '-Is' 옵션은 job을 interactive 모드로 실행하라는 옵션으로, 해당 job이 완료될때까지 기다리도록 합니다. 실제로는 bsub 옵션을 좀더 추가했지만 (예를 들면 '-R' 옵션), 간결함을 위해 여기서는 생략했습니다.

이렇게 해서 MODELZEN은 성공적으로 실행이 됩니다만, 문제는 MODELZEN이 제출하는 각 SPICE 시뮬레이션 job들이 일정기간 대기열에서 기다려야 하기 때문에, 1,000개 이상의 SPICE 시뮬레이션을 실행하는 경우 MODELZEN의 전체 실행시간이 매우 크게 증가하게 됩니다. MODELZEN을 LSF를 통해 실행시키는 좀더 좋은 방법이 있을까요?

1 Answers
Best Answer
SA Support Team Staff 2020-10-21

You made a very keen observation! As you precisely noted, letting MODELZEN run its individual SPICE simulations via LSF can significantly increase the total runtime. Considering that each SPICE simulation launched by MODELZEN is typically a very simple DC or AC simulation completing in a split second, MODELZEN is spending most of the time just waiting for the LSF queue to assign the jobs.

A more efficient way is to launch MODELZEN itself as a job to LSF. This way, MODELZEN is initiated on the LSF-assigned remote machine, and it can launch a set of SPICE simulations on that remote machine without having to wait in the queue again. It is easy to anticipate the amount of resources used by MODELZEN since you can control the maximum number of concurrent SPICE simulations being run by using the '--thread' option on the command line or by setting the devo_options['thread'] option in the technology configuration file.

On the command line, you can launch MODELZEN via LSF using the 'bsub' command. An example is shown below. Please note that you now need to remove the 'bsub' commands from the sim_cmd[...] options in your technology configuration file.

$ bsub -q QUEUE -Is modelzen netlist -c tech_config.py -o model.sv

If you want GLISTER to launch MODELZEN via LSF, you can add these lines after the XMODEL/GLISTER context file (xmodel.cxt) is loaded in the .cdsinit initialization file.

xmodelMODELZEN = "bsub -q QUEUE -Is $XMODEL_HOME/bin/modelzen"
modelzenRunMode = 'batch_bg

These lines define two SKILL variables: the first line sets the xmodelMODELZEN variable to modify the shell command GLISTER uses to launch MODELZEN and the second line sets the modelzenRunMode variable to launch MODELZEN in a background batch mode. It is necessary to switch MODELZEN into a batch mode because LSF blocks the skillIn and skillOut channels used by the default interactive mode for exchanging messages. The background batch mode ('batch_bg) tries to recover the same look-and-feel of the interactive mode.