esiaccel 0.1.5.dev138__cp313-cp313-win_amd64.whl → 0.1.5.dev147__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of esiaccel might be problematic. Click here for more details.

esiaccel/CosimBackend.dll CHANGED
Binary file
Binary file
Binary file
esiaccel/MtiPli.dll CHANGED
Binary file
esiaccel/esi-cosim.py CHANGED
@@ -82,6 +82,24 @@ class SourceFiles:
82
82
  return self.dpi_sv + self.user
83
83
 
84
84
 
85
+ class SimProcess:
86
+
87
+ def __init__(self, proc: subprocess.Popen, port: int):
88
+ self.proc = proc
89
+ self.port = port
90
+
91
+ def force_stop(self):
92
+ """Make sure to stop the simulation no matter what."""
93
+ if self.proc:
94
+ os.killpg(os.getpgid(self.proc.pid), signal.SIGINT)
95
+ # Allow the simulation time to flush its outputs.
96
+ try:
97
+ self.proc.wait(timeout=1.0)
98
+ except subprocess.TimeoutExpired:
99
+ # If the simulation doesn't exit of its own free will, kill it.
100
+ self.proc.kill()
101
+
102
+
85
103
  class Simulator:
86
104
 
87
105
  # Some RTL simulators don't use stderr for error messages. Everything goes to
@@ -135,6 +153,65 @@ class Simulator:
135
153
  """Return the command to run the simulation."""
136
154
  assert False, "Must be implemented by subclass"
137
155
 
156
+ def run_proc(self, gui: bool = False) -> SimProcess:
157
+ """Run the simulation process. Returns the Popen object and the port which
158
+ the simulation is listening on."""
159
+ # Open log files
160
+ self.run_dir.mkdir(parents=True, exist_ok=True)
161
+ simStdout = open(self.run_dir / "sim_stdout.log", "w")
162
+ simStderr = open(self.run_dir / "sim_stderr.log", "w")
163
+
164
+ # Erase the config file if it exists. We don't want to read
165
+ # an old config.
166
+ portFileName = self.run_dir / "cosim.cfg"
167
+ if os.path.exists(portFileName):
168
+ os.remove(portFileName)
169
+
170
+ # Run the simulation.
171
+ simEnv = Simulator.get_env()
172
+ if self.debug:
173
+ simEnv["COSIM_DEBUG_FILE"] = "cosim_debug.log"
174
+ if "DEBUG_PERIOD" not in simEnv:
175
+ # Slow the simulation down to one tick per millisecond.
176
+ simEnv["DEBUG_PERIOD"] = "1"
177
+ rcmd = self.run_command(gui)
178
+ simProc = subprocess.Popen(self.run_command(gui),
179
+ stdout=simStdout,
180
+ stderr=simStderr,
181
+ env=simEnv,
182
+ cwd=self.run_dir,
183
+ preexec_fn=os.setsid)
184
+ simStderr.close()
185
+ simStdout.close()
186
+
187
+ # Get the port which the simulation RPC selected.
188
+ checkCount = 0
189
+ while (not os.path.exists(portFileName)) and \
190
+ simProc.poll() is None:
191
+ time.sleep(0.1)
192
+ checkCount += 1
193
+ if checkCount > 500 and not gui:
194
+ raise Exception(f"Cosim never wrote cfg file: {portFileName}")
195
+ port = -1
196
+ while port < 0:
197
+ portFile = open(portFileName, "r")
198
+ for line in portFile.readlines():
199
+ m = re.match("port: (\\d+)", line)
200
+ if m is not None:
201
+ port = int(m.group(1))
202
+ portFile.close()
203
+
204
+ # Wait for the simulation to start accepting RPC connections.
205
+ checkCount = 0
206
+ while not is_port_open(port):
207
+ checkCount += 1
208
+ if checkCount > 200:
209
+ raise Exception(f"Cosim RPC port ({port}) never opened")
210
+ if simProc.poll() is not None:
211
+ raise Exception("Simulation exited early")
212
+ time.sleep(0.05)
213
+ return SimProcess(proc=simProc, port=port)
214
+
138
215
  def run(self,
139
216
  inner_command: str,
140
217
  gui: bool = False,
@@ -146,83 +223,23 @@ class Simulator:
146
223
  # syntax errors in that block.
147
224
  simProc = None
148
225
  try:
149
- # Open log files
150
- self.run_dir.mkdir(parents=True, exist_ok=True)
151
- simStdout = open(self.run_dir / "sim_stdout.log", "w")
152
- simStderr = open(self.run_dir / "sim_stderr.log", "w")
153
-
154
- # Erase the config file if it exists. We don't want to read
155
- # an old config.
156
- portFileName = self.run_dir / "cosim.cfg"
157
- if os.path.exists(portFileName):
158
- os.remove(portFileName)
159
-
160
- # Run the simulation.
161
- simEnv = Simulator.get_env()
162
- if self.debug:
163
- simEnv["COSIM_DEBUG_FILE"] = "cosim_debug.log"
164
- if "DEBUG_PERIOD" not in simEnv:
165
- # Slow the simulation down to one tick per millisecond.
166
- simEnv["DEBUG_PERIOD"] = "1"
167
- simProc = subprocess.Popen(self.run_command(gui),
168
- stdout=simStdout,
169
- stderr=simStderr,
170
- env=simEnv,
171
- cwd=self.run_dir,
172
- preexec_fn=os.setsid)
173
- simStderr.close()
174
- simStdout.close()
175
-
176
- # Get the port which the simulation RPC selected.
177
- checkCount = 0
178
- while (not os.path.exists(portFileName)) and \
179
- simProc.poll() is None:
180
- time.sleep(0.1)
181
- checkCount += 1
182
- if checkCount > 200 and not gui:
183
- raise Exception(f"Cosim never wrote cfg file: {portFileName}")
184
- port = -1
185
- while port < 0:
186
- portFile = open(portFileName, "r")
187
- for line in portFile.readlines():
188
- m = re.match("port: (\\d+)", line)
189
- if m is not None:
190
- port = int(m.group(1))
191
- portFile.close()
192
-
193
- # Wait for the simulation to start accepting RPC connections.
194
- checkCount = 0
195
- while not is_port_open(port):
196
- checkCount += 1
197
- if checkCount > 200:
198
- raise Exception(f"Cosim RPC port ({port}) never opened")
199
- if simProc.poll() is not None:
200
- raise Exception("Simulation exited early")
201
- time.sleep(0.05)
202
-
226
+ simProc = self.run_proc(gui=gui)
203
227
  if server_only:
204
228
  # wait for user input to kill the server
205
229
  input(
206
- f"Running in server-only mode on port {port} - Press anything to kill the server..."
230
+ f"Running in server-only mode on port {simProc.port} - Press anything to kill the server..."
207
231
  )
208
232
  return 0
209
233
  else:
210
234
  # Run the inner command, passing the connection info via environment vars.
211
235
  testEnv = os.environ.copy()
212
- testEnv["ESI_COSIM_PORT"] = str(port)
236
+ testEnv["ESI_COSIM_PORT"] = str(simProc.port)
213
237
  testEnv["ESI_COSIM_HOST"] = "localhost"
214
238
  return subprocess.run(inner_command, cwd=os.getcwd(),
215
239
  env=testEnv).returncode
216
240
  finally:
217
- # Make sure to stop the simulation no matter what.
218
241
  if simProc:
219
- os.killpg(os.getpgid(simProc.pid), signal.SIGINT)
220
- # Allow the simulation time to flush its outputs.
221
- try:
222
- simProc.wait(timeout=1.0)
223
- except subprocess.TimeoutExpired:
224
- # If the simulation doesn't exit of its own free will, kill it.
225
- simProc.kill()
242
+ simProc.force_stop()
226
243
 
227
244
 
228
245
  class Verilator(Simulator):
Binary file
esiaccel/esiquery.exe CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esiaccel
3
- Version: 0.1.5.dev138
3
+ Version: 0.1.5.dev147
4
4
  Summary: ESI accelerators runtime
5
5
  Author-email: John Demme <John.Demme@microsoft.com>
6
6
  License: ==============================================================================
@@ -1,17 +1,17 @@
1
- esiaccel/CosimBackend.dll,sha256=wde-KSetQ_kLivkwaz2QZojox23PltB56S98L-K1hwE,7152128
1
+ esiaccel/CosimBackend.dll,sha256=yklyOlGNQ3G0x4DZXE2-HlJNouQP6PMKtMz3wEIKY-c,7152128
2
2
  esiaccel/CosimBackend.lib,sha256=UjflmgR93Kl22Du0lTqGhXWQqWEF-V8VwcqUuFo8GNk,4992924
3
- esiaccel/ESICppRuntime.dll,sha256=eqVIWzyibawtNVr3IU8wuHDn4Ou1WGMkjDyugddc3L0,4078592
3
+ esiaccel/ESICppRuntime.dll,sha256=fn48XW39TccmMns1NW8RLTDCFao9jOByz-DLSpoxi7E,4078592
4
4
  esiaccel/ESICppRuntime.lib,sha256=iGJtktQywYhQCody90jvprSYC7kB9LWt3LEX5yIGEkM,15154004
5
- esiaccel/EsiCosimDpiServer.dll,sha256=7rhUY6s7vN04EW18DbRfLaYjc4pJfMmeJiZmI-9Aqiw,159744
5
+ esiaccel/EsiCosimDpiServer.dll,sha256=u1lDgWDmvW4UWCcft6VxE-qLwh_pkmKCo6EXP_8V4GY,159744
6
6
  esiaccel/EsiCosimDpiServer.lib,sha256=bYBigD0RtRRSEiDxf4_gvpasLjD8fcUmC0CjRgQiQ0s,604164
7
- esiaccel/MtiPli.dll,sha256=SG3AJtLGHG6t6QlWQDEzfKBAGykuXKSn-8jZRjSEmWA,14848
7
+ esiaccel/MtiPli.dll,sha256=Pvqx1d1mXk09SuzOJg_tgGCbKz7gCEFPSNlJSPmW09k,14848
8
8
  esiaccel/MtiPli.lib,sha256=X0PcXwheCUvBMgQ5BAawePxbXQSLNk5M1FFn6V56ydo,14570
9
9
  esiaccel/__init__.py,sha256=65xXWHwJwRePsyhWk837NpzuN0qsNhoAX29TOiSYKGc,905
10
10
  esiaccel/accelerator.py,sha256=BcXPsUqcQV3YsVVyYbz9P6JnZLlcnuageFbJwID9_3s,3318
11
11
  esiaccel/codegen.py,sha256=uoYELtnIabVvgLeCABj-mWras0BvmSKABPH-cd9nDFk,6560
12
- esiaccel/esi-cosim.py,sha256=GwYfNh4aagypheAhGf0EIX6ojkLYKkc5OMlFR9pfXe8,14381
13
- esiaccel/esiCppAccel.cp313-win_amd64.pyd,sha256=YtEbmof0UAdO4FccGknyvqAgH6T9gIWFnsLTucwy1Ec,510976
14
- esiaccel/esiquery.exe,sha256=-GvmCGvb94CkMGDuO0KAJIO0x3AKWxj0evmWsIsMLe4,441856
12
+ esiaccel/esi-cosim.py,sha256=JHPgS6jjC655afz7pNBh47cAjyRTiqMKRM3tCsszYM4,14796
13
+ esiaccel/esiCppAccel.cp313-win_amd64.pyd,sha256=4onhaJ4ZkGt2RXE8XICyE5EqCze2M0BxrKIaefOjRc8,510976
14
+ esiaccel/esiquery.exe,sha256=c5st9XuyCi_T7-LtMosBh6iQ3JaiEjLuPR06fLdvjX8,441856
15
15
  esiaccel/types.py,sha256=LFLzUCvtYF6FLsmKet6eJTMq2ija2Z5kxd5Ks6tkS4U,19044
16
16
  esiaccel/utils.py,sha256=q-8fmgJ9tUvmBsIvqZiZ7u845IJhOjvjYTQLhhrNYl0,1515
17
17
  esiaccel/cmake/esiaccelConfig.cmake,sha256=u2aW99k1lEcmYTG1P3BTJqtmDrj53wUUaBz_jzw8kYY,565
@@ -35,9 +35,9 @@ esiaccel/include/esi/Utils.h,sha256=KPd75GajIFeTBVJocXBjwsJqhbZg-ShWZCIe3oQdBss,
35
35
  esiaccel/include/esi/backends/Cosim.h,sha256=s7vYd0ra6m1nvk-n37MjvBoGVI-CCUKBt0DU4PKlaHM,2838
36
36
  esiaccel/include/esi/backends/RpcServer.h,sha256=WMwnhwU2qnrcglGNeiKg9QQHpkDx1QE1JydKYDK4jqE,1856
37
37
  esiaccel/include/esi/backends/Trace.h,sha256=kx4wwLH3a0ndmRUdaDyYGZ1SP83zlpFrk30Nw8ZrJJA,3286
38
- esiaccel-0.1.5.dev138.dist-info/licenses/LICENSE,sha256=vtnVnB8_lN1yPYcA5MeT56R8UsQtBhyzZLBvu_KMf7I,13468
39
- esiaccel-0.1.5.dev138.dist-info/METADATA,sha256=YQqAggLDdoG1ATE0w2j-xfAXui1Bw-luzvKtRRlPnzw,16148
40
- esiaccel-0.1.5.dev138.dist-info/WHEEL,sha256=qV0EIPljj1XC_vuSatRWjn02nZIz3N1t8jsZz7HBr2U,101
41
- esiaccel-0.1.5.dev138.dist-info/entry_points.txt,sha256=_CuNLV0fyTURxRREFwpzGycifZW_-7-MyuJNEwKK9J8,137
42
- esiaccel-0.1.5.dev138.dist-info/top_level.txt,sha256=fYWTWMDK4PDu4ePQ9NtcFHas2k8-d1kWhTs2avPpgB4,9
43
- esiaccel-0.1.5.dev138.dist-info/RECORD,,
38
+ esiaccel-0.1.5.dev147.dist-info/licenses/LICENSE,sha256=vtnVnB8_lN1yPYcA5MeT56R8UsQtBhyzZLBvu_KMf7I,13468
39
+ esiaccel-0.1.5.dev147.dist-info/METADATA,sha256=oxZUJ15Qr6eLJeMDWCKVnCncAT1a9lAyqNFBrqKtzys,16148
40
+ esiaccel-0.1.5.dev147.dist-info/WHEEL,sha256=qV0EIPljj1XC_vuSatRWjn02nZIz3N1t8jsZz7HBr2U,101
41
+ esiaccel-0.1.5.dev147.dist-info/entry_points.txt,sha256=_CuNLV0fyTURxRREFwpzGycifZW_-7-MyuJNEwKK9J8,137
42
+ esiaccel-0.1.5.dev147.dist-info/top_level.txt,sha256=fYWTWMDK4PDu4ePQ9NtcFHas2k8-d1kWhTs2avPpgB4,9
43
+ esiaccel-0.1.5.dev147.dist-info/RECORD,,