lumapi doesn’t raise errors upon solver crashing


    • jev1


      I have a problem using the lumapi to control Interconnect. When I load a .spi file that has an error in a model definition, Interconnect crashes and closes down but it never raises an error in the API, so the rest of my code just freezes. The handle in the API still thinks the solver is alive and well. I prevented the execution from getting frozen by running interconnect in a thread, but then when I go back to try and check if the handle is available, the API doesn't seem to know anything about it being dead.

      I expected calling lumapi.verifyConnection(handle) would detect the lost connection, but it doesn't raise any exceptions. Is there a way to correctly determine if my connection is alive (lumerical hasn't crashed).

      Here is a minimal example of what I mention

      import subprocess
      import lumapi
      from lumapi import LumApiError

      import threading
      solver ='interconnect')

      def thread_eval(folder, file_name):

      lumapi.evalScript(solver, "cd ('" + folder + "');\n")
      lumapi.evalScript(solver, "feval('" + file_name + "');\n")

      if __name__ == '__main__':

      tmp_folder = 'C:\\Users\\jev1\\test\\lumapi_closing\\'
      p = threading.Thread(target=thread_eval, name="Load and Run Circuit", args=(tmp_folder, 'TOP'))
      if p.is_alive():

      print('Interconnect is not responding, the next line should raise an error if the solver is closed.')


      except LumApiError:

      raise LumApiError


      print("... But it didn't!")

      Of course, better than that is, how to prevent Interconnect from crashing when faulty .spi netlist gets loaded.

    • Greg Baethge
      Ansys Employee

      Hi @jev1,

      Thanks for posting your question. As you noted, these are 2 separate issues. Regarding the API issue, I did a quick test, closing the solver then running verifyConnection, it detected the solver was closed so I'm wondering, when this happens, could you check if there's still an interconnect process running?

      Regarding the netlist import, does it crash also if you manually import the netlist in INTERCONNECT? Or is it only via the API?

      Finally, could you let us know what version of INTERCONNECT you are using?

Viewing 1 reply thread
  • You must be logged in to reply to this topic.