# Access Gurobi Work Time

**URL:** https://discuss.ampl.com/t/access-gurobi-work-time/991
**Category:** Support
**Tags:** solvers, displays-results
**Created:** [March 8, 2024, 5:08pm UTC](https://discuss.ampl.com/t/access-gurobi-work-time/991 "2024-03-08T17:08:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![salvapineda](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/salvapineda/32/692_2.png) [@salvapineda](https://discuss.ampl.com/u/salvapineda)
#### Post date: [March 8, 2024, 5:08pm UTC](https://discuss.ampl.com/t/access-gurobi-work-time/991/1 "2024-03-08T17:08:54Z")

</div>

I’m solving a linear problem with amplpy and gurobi. As shown below, the work time (cpu time) required by Gurobi is 0.12 seconds. However, the times I get from ampl (solve\_time, etc) are different. Is there a way to access the work time reported by Gurobi?

solve\_time= 0.560407  
solve\_user\_time = 0.5321859999999999  
ampl\_elapsed\_time = 0.7073279999999997  
solve\_elapsed\_time = 0.5976950000000001

Gurobi Optimizer version 10.0.1 build v10.0.1rc0 (linux64)

CPU model: Intel(R) Xeon(R) Gold 6230R CPU @ 2.10GHz, instruction set [SSE2|AVX|AVX2|AVX512]  
Thread count: 52 physical cores, 52 logical processors, using up to 1 threads

Optimize a model with 200 rows, 1000 columns and 200000 nonzeros  
Model fingerprint: 0x1df715c0  
Coefficient statistics:  
Matrix range [2e-05, 2e+01]  
Objective range [1e-03, 3e+00]  
Bounds range [2e-03, 2e+01]  
RHS range [8e-01, 3e+01]  
Presolve time: 0.05s  
Presolved: 200 rows, 1000 columns, 200000 nonzeros

Iteration Objective Primal Inf. Dual Inf. Time  
0 -4.2643980e+05 4.652726e+07 0.000000e+00 0s  
424 -2.2936302e+03 0.000000e+00 0.000000e+00 0s

Solved in 424 iterations and 0.12 seconds (0.19 work units)  
Optimal objective -2.293630200e+03

---

<div class="post-metadata">

### Author: ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)
#### Post date: [March 11, 2024, 8:20pm UTC](https://discuss.ampl.com/t/access-gurobi-work-time/991/2 "2024-03-11T20:20:33Z")

</div>

Hi @salvapineda,

We have just released Gurobi 20240311 ([GUROBI Changelog — AMPL Resources](https://dev.ampl.com/solvers/gurobi/changes.html)) and this version adds the option `tech:reportwork` ([GUROBI Options — AMPL Resources](https://dev.ampl.com/solvers/gurobi/options.html)) that when set to 1, returns the work ammount reported by Gurobi as a problem suffix (If you don’t have problem definitions, the default problem is `Initial`).

You can use this feature as follows:

```python
ampl = AMPL()
...
ampl.solve(solver="gurobi", gurobi_options="outlev=1 tech:reportwork=1")
print("Work:", ampl.get_value("Initial.work"))

```

Please let us know if you encounter any issues using it!
