MCPcopy Index your code
hub / github.com/evalplus/evalplus / _run

Function _run

evalplus/perf/profile.py:147–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145 timeout = timeout_second_per_test * len(test_inputs) * profile_rounds
146
147 def _run():
148 compute_cost = Value("d", 0.0)
149 progress = Value("i", _STAT_NONE)
150
151 p = Process(
152 target=get_instruction_count_shared_mem,
153 args=(
154 profiler,
155 func_code,
156 entry_point,
157 test_inputs,
158 timeout_second_per_test,
159 memory_bound_gb,
160 warmup_inputs,
161 # shared memory
162 compute_cost,
163 progress,
164 ),
165 )
166 p.start()
167 p.join(timeout=timeout + 1)
168 if p.is_alive():
169 p.terminate()
170 time.sleep(0.1)
171
172 if p.is_alive():
173 p.kill()
174 time.sleep(0.1)
175
176 if progress.value == _STAT_SUCC:
177 return compute_cost.value
178 elif progress.value == _STAT_NONE:
179 return "PROFILING DID NOT START"
180 elif progress.value == _STAT_ERROR:
181 return "SOLUTION ERROR ENCOUNTERED WHILE PROFILING"
182
183 return [_run() for _ in range(profile_rounds)]

Callers 1

profileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…