Author Topic: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads  (Read 7966 times)

0 Members and 1 Guest are viewing this topic.

Offline hanakpTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: cz
OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« on: March 16, 2023, 12:11:58 pm »
Hello, in my workplace, we're using Orcad Capture to draw simulation schematics and PSpice to run them. We have rather old version 16.6 (upgrades are pricey) and I noticed it uses only 4 CPU threads during computation. That slows things down (even free LTspice can use up to 20 threads now). According to this document, the number of threads can be set via .OPTIONS THREADS command. I have two questions about it:

1. How I can actually use the .OPTION command in Capture? I've never done it before. Is it somewhere in the GUI menus? Or is there a special part like PARAM? Or do I have to manually edit the Spice file? And if so, how?

2. The document above says "Maximum 4 threads can be used for regular PSpice Licenses". But that document is for old 16.6 version. Is the limit higher in newer versions? Or do we need to buy some special (and presumably expensive) separate license to unlock more threads? I couldn't find this information anywhere.

Thanks!
« Last Edit: March 17, 2023, 11:38:38 am by hanakp »
 

Offline hanakpTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: cz
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #1 on: March 29, 2023, 12:34:27 pm »
I solved the problem, but the results were contrary to my expectations.

Short version: Orcad PSpice versions 16.6 and 17.2 are very poorly optimized for multi-CPU/multi-thread PCs and run the fastest on 1 thread only. Enabling more than 1 thread slows down transient simulations significantly.

Long version: I discussed it with a colleague from a different department who has newer PSpice 17.2. In it, the number of threads can be changed from the GUI, it's hidden in Edit Simulation Profile -> Options -> Number of Threads. It's set to 0 by default, which means PSpice employs half the threads available in the PC. In my case it was 12, beause I currently work on AMD Threadripper 2920X (12C/24T). But when I limited it to 1 thread, transient simulations suddenly run more than twice as fast!! Setting it to 2 or 8 threads doesn't make much difference, it's almost as slow as default 12. It has no effect on AC simulations, they always take the same time. According to the colleague, HSpice simulator and Intel CPUs also suffer from this problem. Apparently, Cadence haven't even touched the Spice core in the last 15 years or so - even free LTspice is light-years ahead when it comes to multi-threading.

Unfortunately, we found no way to how to set the number of threads globally in PSpice, you have to change it manually for every single new project. But the colleague created library CUSTOM.OLB which contains a special part OPT_CMD. You can place it into Capture schematic and it passes .OPTIONS to the simulator. I'm attaching it below, it should work with all .OPTIONS commands PSpice recognizes. Enter only one command per part, but theoretically you can place as many OPT_CMDs as you want. For example, the ACCT command appends CPU, memory, runtime and other statistics to the resulting .OUT file. That's how I measured the runtime.

Which brings me to another question: does anybody have the latest PSpice 22? And if so, did they improve its multithreading?
 

Offline Uky

  • Regular Contributor
  • *
  • Posts: 108
  • Country: se
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #2 on: March 30, 2023, 02:40:55 pm »
I know that there has been comments in the world of simulations that AMD CPU's (like Threadrippers) used for simulation sometimes does the job slower that the corresponding Intel processors due to the fact that the many simulation softwares are compiled using Intel code libraries. So I got puzzled when you write that also Intel CPU exhibits the same behavior.

I also know that some softwares, like CST (3D EM-simulator) does not "like" hyperthreading (two threads per core) for some simulation setups. The software warns about it when starting a simulation and turns off the hyperthreading and instead relies only on multiple "true" cores.

If Cadence PSpice simulator can make full use of many "true" cores, I do not know. Did you disable the hyperthreading in the BIOS to see if that was a part of the problem?

 

Offline hanakpTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: cz
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #3 on: March 31, 2023, 09:58:10 am »
I'm a bit wary to disable HT on my current machine, Windows sometimes doesn't take such BIOS changes well. But I'll look which PSpice version I have on my old PC, I think it has an Intel CPU.

In the meantime, I found out another odd thing: you really have to set the number of threads in Orcad/PSpice and not externally. You see, back in olden times, when HT Pentium 4 and Athlon X2 were introduced, lots of programs refused to run properly on them, particularly games. You had to force such programs to use only one CPU, which could be done by changing "Processor affinity" in Windows Task manager. There were utilites that could automate this, I'd been using Process Lasso. But that doesn't work on PSpice - when I change the affinity for SimSrvr.exe to one CPU only, the simulation still takes over 2 times as long.
 

Offline Warhawk

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: 00
    • Personal resume
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #4 on: March 31, 2023, 03:18:49 pm »
Hello, in my workplace, we're using Orcad Capture to draw simulation schematics and PSpice to run them. We have rather old version 16.6 (upgrades are pricey) and I noticed it uses only 4 CPU threads during computation. That slows things down (even free LTspice can use up to 20 threads now). According to this document, the number of threads can be set via .OPTIONS THREADS command. I have two questions about it:

1. How I can actually use the .OPTION command in Capture? I've never done it before. Is it somewhere in the GUI menus? Or is there a special part like PARAM? Or do I have to manually edit the Spice file? And if so, how?

2. The document above says "Maximum 4 threads can be used for regular PSpice Licenses". But that document is for old 16.6 version. Is the limit higher in newer versions? Or do we need to buy some special (and presumably expensive) separate license to unlock more threads? I couldn't find this information anywhere.

Thanks!

Ahoj Kolego,

you can pass the option from Capture to pSpice netlist using @pspice: clause. See the picture attached. For some reason, this is nearly impossible to find online. People simply don't know it. I struggled with it about two months ago.

The attached capture diagram generates this netlist:
Code: [Select]
* source PSPICE-LOGIC
* PSpice Text Block on SCHEMATIC1 PAGE1
.OPTION TRTOL=10
***
X_U1         N00327 N00186 N00119 0 SN74LVC1G04
V_V1         N00119 0 3.3
R_R1         0 N00327  1Meg TC=0,0
V_V2         N00186 0 
+PULSE 0 3.3 1u 100p 100p 30u 50u


Offline hanakpTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: cz
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #5 on: April 20, 2023, 11:00:57 am »
@Warhawk: thanks, it really works! Much more practical than the special library part!

In the meantime, I found my old Intel PC, but of course I transferred PSpice license to the new PC, so I can't get past the splash screen. The joys of some commercial software... So I tried disabling multithreading in BIOS on my current Threadripper machine as @Uky suggested, but nothing changed - enabling more than 1 thread causes transient simulations take over 2 times as long to complete.
 

Offline Warhawk

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: 00
    • Personal resume
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #6 on: April 20, 2023, 07:23:02 pm »
Can you try "set afinity" option in the task manager? I run windows 11. It looks different.

Offline Uky

  • Regular Contributor
  • *
  • Posts: 108
  • Country: se
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #7 on: April 20, 2023, 08:22:36 pm »
I attended a Cadence seminar the other day and asked about the behavior of pSPice.

Another gentleman in the audience had the exact same experience with some simulations
but not with other.

The answer we were given was that:

When doing simulations with a large number of nodes, multicores are computing different parts of the schematic.
Simulation tasks using a small number of nodes does not benefit at all from multicores.

(When I have had problems with a locked splash-screens, there is often a dialog box hidden behind it
waiting for a response in order to close and letting the software invocation proceed.
I have fixed that by using Alt-Tab until the dialog box appears and a response could be entered be it clicking OK or whatever...)
 

Offline hanakpTopic starter

  • Regular Contributor
  • *
  • Posts: 97
  • Country: cz
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #8 on: April 21, 2023, 09:27:38 am »
@Warhawk: as I wrote earlier, changing the affinity in W10 has no effect. You really need to configure the threads from within Orcad/PSpice.

@Uky: Thanks for the info, but... it doesn't explain why PSpice runs slower for low node numbers (my test schematic had only 108 of them). Did they mention what's considered "large number of nodes"? Thousands? More?
 

Offline Warhawk

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: 00
    • Personal resume
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #9 on: April 21, 2023, 09:48:16 am »
Quote
as I wrote earlier, changing the affinity in W10 has no effect. You really need to configure the threads from within Orcad/PSpice.
I am sorry, I overlooked it :)

Offline Uky

  • Regular Contributor
  • *
  • Posts: 108
  • Country: se
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #10 on: April 21, 2023, 12:34:34 pm »
... It was a seminar about upcoming releases, the benefits and adaptation to PLM-systems etc.
pSpice was mentioned as a method for advanced analysis (the license that I do not have) of thermal
and other issues. During Q&A the multi-core problem came up but no details were given.

I myself do most of my simulations in the frequency domain so I felt that I was
not qualified to ask detailed questions regarding pSpice...

I suggest rising the question in the Cadence User forum. No need to have a maintenance contract.
Registering is free.

 :)
 

Offline alager

  • Newbie
  • Posts: 9
  • Country: us
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #11 on: January 31, 2024, 11:13:40 pm »
@Warhawk I'm a newb on options in Orcad.  Do you just use the "Place Text" and put in @pspice: .OPTIONS THREADS=1
In LTSpice, there are two input options, one for text and one for .options, that's why I ask.
 

Offline Warhawk

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: 00
    • Personal resume
Re: OrCAD Capture+PSpice: .OPTIONS and number of CPU threads
« Reply #12 on: February 05, 2024, 08:17:02 pm »
Hi, yes, this is just text. You can try to put there some rubbish after @pspice: to check if this results in error when running the simulation. :phew:


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf