Currently, sharedspice uses a global state, as the initialization function does not allow passing state information when interfacing with the ngspice.dll. When simulating two instances of different PDKs simultaneously, this requires loading two separate copies of the same dynamic library. Could ngspice be enhanced to include an opaque index or instance identifier? This would enable a single ngspice.dll to manage multiple simulation states, with the index specifying which state to access, rather than requiring multiple library instances to be loaded. Is the current approach of loading the library twice intentional, or would this proposed change be a viable improvement?
It is not possible to run 2 or more circuit instances in a single executable. It will not be possible to enhance ngspice to do so, as for example many global variables and structures are used, e.g. to store the circuit and simulation state.
Therefore loading the library several times is the recommended way to handle parallel simulation.