当前位置: 首页 > backend >正文

cuOpt_server错误分析

cuOpt错误效果

cuopt_server的输出

启动cuoptserver进行计算之后,发现输出如下所示:

(cuopt_env_2) yxd@4029GP-TRT:~/yyj$ python -m cuopt_server.cuopt_service --ip $ip --port $port
/opt/anaconda3/envs/cuopt_env_2/lib/python3.10/runpy.py:126: RuntimeWarning: 'cuopt_server.cuopt_service' found in sys.modules after import of package 'cuopt_server', but prior to execution of 'cuopt_server.cuopt_service'; this may result in unpredictable behaviourwarn(RuntimeWarning(msg))
2025-08-09 20:21:24.368 INFO cuopt server version 25.05.01
2025-08-09 20:21:24.369 DEBUG cuopt_server/utils/request_filter.py:set_tier Tier is managed_default
2025-08-09 20:21:24.369 INFO | NVIDIA-SMI 550.163.01             Driver Version: 550.163.01     CUDA Version: 12.4     |
2025-08-09 20:21:24.369 INFO GPU 0: NVIDIA GeForce RTX 3090 (UUID: GPU-430bdc34-7255-df8a-794b-7daa6ef8dfde), GPU 1: NVIDIA GeForce RTX 3090 (UUID: GPU-d9959067-7a30-0ffe-b4ec-f346858f3c17), GPU 2: NVIDIA GeForce RTX 3090 (UUID: GPU-4900090d-36f1-02ad-9b59-1cf9a5645e06), GPU 3: NVIDIA GeForce RTX 3090 (UUID: GPU-808e8e90-5de8-d52c-61d0-c7743395c615), GPU 4: NVIDIA GeForce RTX 3090 (UUID: GPU-2e32f8f6-a451-9073-e107-3cb544fb16bf), GPU 5: NVIDIA GeForce RTX 3090 (UUID: GPU-8d535807-a2e4-e031-7f80-aacb5f29e272), GPU 6: NVIDIA GeForce RTX 3090 (UUID: GPU-36778b0c-238e-686d-8e06-6f051ae46229), GPU 7: NVIDIA GeForce RTX 3090 (UUID: GPU-714a962a-7aa2-80ce-bd6c-f0becfdd79df)
2025-08-09 20:21:24.390 INFO Starting new process with pid 119055
2025-08-09 20:21:24.490 DEBUG Using selector: EpollSelector
2025-08-09 20:21:24.505 INFO Started server process [119057]
2025-08-09 20:21:24.505 INFO Waiting for application startup.
2025-08-09 20:21:24.505 INFO Application startup complete.
2025-08-09 20:21:24.507 INFO Uvicorn running on http://localhost:5000 (Press CTRL+C to quit)
2025-08-09 20:21:24.653 INFO solver rmm pool size in gigabytes 1 (GPU 0)
2025-08-09 20:21:24.653 INFO solver waiting on job queue (GPU 0)
2025-08-09 20:21:40.303 DEBUG client_vers is 25.05.01 in check
2025-08-09 20:21:40.303 DEBUG time to receive data 5.984306335449219e-05
2025-08-09 20:21:40.304 INFO waiting for job e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f with timeout 0
2025-08-09 20:21:40.304 DEBUG job_result returning msgpack
2025-08-09 20:21:40.304 INFO 127.0.0.1:44482 - "POST /cuopt/request?validation_only=False&cache=False&incumbent_solutions=False&solver_logs=True HTTP/1.1" 200
2025-08-09 20:21:40.305 INFO solver with 119055 received job e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f (GPU 0)
2025-08-09 20:21:40.317 INFO Extracting logs from log_e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f
2025-08-09 20:21:40.318 ERROR {'cuopt_trace': ['fastapi.exceptions.HTTPException: 404: log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f\n'], 'counter': 0, 'msg': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f'}
2025-08-09 20:21:40.318 ERROR {'cuopt_exception': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f', 'status_code': 404}
2025-08-09 20:21:40.319 INFO 127.0.0.1:44488 - "GET /cuopt/log/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f?frombyte=0 HTTP/1.1" 404
2025-08-09 20:21:41.313 DEBUG job_result returning msgpack
2025-08-09 20:21:41.313 INFO 127.0.0.1:44504 - "GET /cuopt/solution/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f HTTP/1.1" 200
2025-08-09 20:21:41.324 INFO Extracting logs from log_e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f
2025-08-09 20:21:41.324 ERROR {'cuopt_trace': ['fastapi.exceptions.HTTPException: 404: log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f\n'], 'counter': 0, 'msg': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f'}
2025-08-09 20:21:41.324 ERROR {'cuopt_exception': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f', 'status_code': 404}
2025-08-09 20:21:41.325 INFO 127.0.0.1:44516 - "GET /cuopt/log/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f?frombyte=0 HTTP/1.1" 404
2025-08-09 20:21:42.319 DEBUG job_result returning msgpack
2025-08-09 20:21:42.319 INFO 127.0.0.1:44526 - "GET /cuopt/solution/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f HTTP/1.1" 200
2025-08-09 20:21:42.330 INFO Extracting logs from log_e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f
2025-08-09 20:21:42.330 ERROR {'cuopt_trace': ['fastapi.exceptions.HTTPException: 404: log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f\n'], 'counter': 0, 'msg': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f'}
2025-08-09 20:21:42.330 ERROR {'cuopt_exception': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f', 'status_code': 404}
2025-08-09 20:21:42.331 INFO 127.0.0.1:44534 - "GET /cuopt/log/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f?frombyte=0 HTTP/1.1" 404
2025-08-09 20:21:42.360 DEBUG decode as msgpack (GPU 0)
2025-08-09 20:21:42.360 INFO transform time 5.412101745605469e-05 (GPU 0)
2025-08-09 20:21:42.361 INFO transform time 3.218650817871094e-05 (GPU 0)
2025-08-09 20:21:42.361 INFO transform time 2.4557113647460938e-05 (GPU 0)
2025-08-09 20:21:42.361 INFO transform time 2.288818359375e-05 (GPU 0)
2025-08-09 20:21:42.361 INFO transform time 2.2649765014648438e-05 (GPU 0)
2025-08-09 20:21:42.361 INFO transform time 2.193450927734375e-05 (GPU 0)
2025-08-09 20:21:42.361 INFO transform time 6.413459777832031e-05 (GPU 0)
2025-08-09 20:21:42.362 INFO transform time 4.172325134277344e-05 (GPU 0)
2025-08-09 20:21:42.362 INFO transform time 4.9591064453125e-05 (GPU 0)
2025-08-09 20:21:42.362 INFO transform time 4.601478576660156e-05 (GPU 0)
2025-08-09 20:21:42.362 INFO transform time 4.5299530029296875e-05 (GPU 0)
2025-08-09 20:21:42.362 INFO transform time 4.601478576660156e-05 (GPU 0)
2025-08-09 20:21:42.363 INFO transform time 8.487701416015625e-05 (GPU 0)
2025-08-09 20:21:42.363 INFO transform time 6.365776062011719e-05 (GPU 0)
2025-08-09 20:21:42.364 INFO transform time 4.4345855712890625e-05 (GPU 0)
2025-08-09 20:21:42.364 INFO transform time 4.482269287109375e-05 (GPU 0)
2025-08-09 20:21:42.364 INFO transform time 4.982948303222656e-05 (GPU 0)
2025-08-09 20:21:42.364 INFO transform time 4.506111145019531e-05 (GPU 0)
2025-08-09 20:21:42.364 INFO transform time 4.291534423828125e-05 (GPU 0)
2025-08-09 20:21:42.365 INFO transform time 4.124641418457031e-05 (GPU 0)
2025-08-09 20:21:42.365 INFO transform time 4.029273986816406e-05 (GPU 0)
2025-08-09 20:21:42.365 INFO transform time 3.981590270996094e-05 (GPU 0)
2025-08-09 20:21:42.365 INFO transform time 4.839897155761719e-05 (GPU 0)
2025-08-09 20:21:42.365 INFO transform time 3.8623809814453125e-05 (GPU 0)
2025-08-09 20:21:42.366 INFO transform time 2.765655517578125e-05 (GPU 0)
2025-08-09 20:21:43.069 DEBUG etl_time 0.0004467964172363281 (GPU 0)
2025-08-09 20:21:43.069 INFO Writing logs to log_e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f (GPU 0)
Setting parameter infeasibility_detection to false
Setting parameter pdlp_solver_mode to 1
Setting parameter method to 0
Setting parameter crossover to false
Setting parameter absolute_dual_tolerance to 1.000000e-04
Setting parameter relative_dual_tolerance to 1.000000e-04
Setting parameter absolute_primal_tolerance to 1.000000e-04
Setting parameter relative_primal_tolerance to 1.000000e-04
Setting parameter absolute_gap_tolerance to 1.000000e-04
Setting parameter relative_gap_tolerance to 1.000000e-04
Setting parameter mip_scaling to true
Setting parameter mip_heuristics_only to false
Setting parameter log_to_console to true
Setting parameter log_file to 
Concurrent mode not supported for batch solve. Using PDLP instead. 
Set the CUOPT_METHOD parameter to CUOPT_METHOD_PDLP or CUOPT_METHOD_DUAL_SIMPLEX to avoid this warning.
Setting parameter method to 1
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   TimeIter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   TimeIter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   TimeIter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.043s0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.043s0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.043s0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.043s1 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.098s1 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.098s1 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.098s1 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.105s
2025-08-09 20:21:43.324 DEBUG job_result returning msgpack200 +8.33385755e-01 +8.33406447e-01  2.07e-05   0.00e+00     5.81e-05   0.128s
LP Solver status:                Optimal
Primal objective:                +8.33385755e-01
Dual objective:                  +8.33406447e-01
2025-08-09 20:21:43.325 INFO 127.0.0.1:44546 - "GET /cuopt/solution/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f HTTP/1.1" 200
Duality gap (abs/rel):           +2.07e-05 / +7.76e-06
Primal infeasibility (abs/rel):  +0.00e+00 / +0.00e+00
Dual infeasibility (abs/rel):    +5.81e-05 / +2.90e-05
PDLP finished
Status: Optimal   Objective: 8.33385755e-01  Iterations: 200  Time: 0.129s160 +4.58416248e-01 +4.58303209e-01  1.13e-04   0.00e+00     2.09e-05   0.131s
LP Solver status:                Optimal
Primal objective:                +4.58416248e-01
Dual objective:                  +4.58303209e-01
Duality gap (abs/rel):           +1.13e-04 / +5.90e-05
Primal infeasibility (abs/rel):  +0.00e+00 / +0.00e+00
Dual infeasibility (abs/rel):    +2.09e-05 / +1.04e-05
PDLP finished
Status: Optimal   Objective: 4.58416248e-01  Iterations: 160  Time: 0.132s160 +2.08386083e-01 +2.08335643e-01  5.04e-05   3.72e-05     2.73e-05   0.133s
LP Solver status:                Optimal
Primal objective:                +2.08386083e-01
Dual objective:                  +2.08335643e-01
Duality gap (abs/rel):           +5.04e-05 / +3.56e-05
Primal infeasibility (abs/rel):  +3.72e-05 / +1.24e-05
Dual infeasibility (abs/rel):    +2.73e-05 / +1.36e-05
PDLP finished
Status: Optimal   Objective: 2.08386083e-01  Iterations: 160  Time: 0.134s240 +1.99994585e+00 +2.00023841e+00  2.93e-04   4.00e-05     7.91e-05   0.133s
LP Solver status:                Optimal
Primal objective:                +1.99994585e+00
Dual objective:                  +2.00023841e+00
Duality gap (abs/rel):           +2.93e-04 / +5.85e-05
Primal infeasibility (abs/rel):  +4.00e-05 / +1.33e-05
Dual infeasibility (abs/rel):    +7.91e-05 / +3.96e-05
PDLP finished
Status: Optimal   Objective: 1.99994585e+00  Iterations: 240  Time: 0.134s
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000
2025-08-09 20:21:43.336 INFO Extracting logs from log_e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f
2025-08-09 20:21:43.336 ERROR {'cuopt_trace': ['fastapi.exceptions.HTTPException: 404: log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f\n'], 'counter': 0, 'msg': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f'}
2025-08-09 20:21:43.336 ERROR {'cuopt_exception': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f', 'status_code': 404}
2025-08-09 20:21:43.336 INFO 127.0.0.1:44554 - "GET /cuopt/log/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f?frombyte=0 HTTP/1.1" 404
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.0000000 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.013s
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.0000001 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.014sIter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.011s1 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.012sIter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.011s1 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.013sIter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.013s1 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.015s240 +6.66623187e-01 +6.66618827e-01  4.36e-06   4.29e-05     9.68e-06   0.038s
LP Solver status:                Optimal
Primal objective:                +6.66623187e-01
Dual objective:                  +6.66618827e-01
Duality gap (abs/rel):           +4.36e-06 / +1.87e-06
Primal infeasibility (abs/rel):  +4.29e-05 / +1.43e-05
Dual infeasibility (abs/rel):    +9.68e-06 / +4.84e-06
PDLP finished
Status: Optimal   Objective: 6.66623187e-01  Iterations: 240  Time: 0.039s
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.004s1 +0.00000000e+00 +2.61312593e+00  2.61e+00   2.00e+00     1.31e+00   0.005s240 +1.83331155e+00 +1.83286572e+00  4.46e-04   8.39e-06     4.10e-05   0.041s
LP Solver status:                Optimal
Primal objective:                +1.83331155e+00
Dual objective:                  +1.83286572e+00
Duality gap (abs/rel):           +4.46e-04 / +9.55e-05
Primal infeasibility (abs/rel):  +8.39e-06 / +2.80e-06
Dual infeasibility (abs/rel):    +4.10e-05 / +2.05e-05240 +1.66676179e-01 +1.66671348e-01  4.83e-06   0.00e+00     1.38e-05   0.040s
LP Solver status:                Optimal
Primal objective:                +1.66676179e-01
Dual objective:                  +1.66671348e-01
PDLP finished
Status: Optimal   Objective: 1.83331155e+00  Iterations: 240  Time: 0.042s
Duality gap (abs/rel):           +4.83e-06 / +3.62e-06
Primal infeasibility (abs/rel):  +0.00e+00 / +0.00e+00
Dual infeasibility (abs/rel):    +1.38e-05 / +6.91e-06160 +4.16557477e-01 +4.16682498e-01  1.25e-04   9.99e-05     2.89e-05   0.039s
LP Solver status:                Optimal
Primal objective:                +4.16557477e-01
Dual objective:                  +4.16682498e-01
Duality gap (abs/rel):           +1.25e-04 / +6.82e-05
Primal infeasibility (abs/rel):  +9.99e-05 / +3.33e-05
Dual infeasibility (abs/rel):    +2.89e-05 / +1.44e-05
PDLP finished
Status: Optimal   Objective: 1.66676179e-01  Iterations: 240  Time: 0.042s
PDLP finished
Status: Optimal   Objective: 4.16557477e-01  Iterations: 160  Time: 0.041s
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000
Solving a problem with 7 constraints 7 variables (0 integers) and 16 nonzeros
Objective offset 0.000000 scaling_factor 1.000000Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time0 +0.00000000e+00 +0.00000000e+00  0.00e+00   2.00e+00     0.00e+00   0.009s240 +6.24993467e-01 +6.24905402e-01  8.81e-05   5.76e-06     3.79e-05   0.026s
LP Solver status:                Optimal
Primal objective:                +6.24993467e-01
Dual objective:                  +6.24905402e-01
Duality gap (abs/rel):           +8.81e-05 / +3.91e-05
Primal infeasibility (abs/rel):  +5.76e-06 / +1.92e-06
Dual infeasibility (abs/rel):    +3.79e-05 / +1.89e-05
PDLP finished
Status: Optimal   Objective: 6.24993467e-01  Iterations: 240  Time: 0.027s
2025-08-09 20:21:44.331 DEBUG job_result returning msgpack
2025-08-09 20:21:44.332 INFO 127.0.0.1:44564 - "GET /cuopt/solution/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f HTTP/1.1" 200
2025-08-09 20:21:44.342 INFO Extracting logs from log_e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f
2025-08-09 20:21:44.342 ERROR {'cuopt_trace': ['fastapi.exceptions.HTTPException: 404: log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f\n'], 'counter': 0, 'msg': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f'}
2025-08-09 20:21:44.342 ERROR {'cuopt_exception': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f', 'status_code': 404}
2025-08-09 20:21:44.343 INFO 127.0.0.1:44568 - "GET /cuopt/log/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f?frombyte=0 HTTP/1.1" 404
2025-08-09 20:21:44.739 INFO cuopt received signal 17
2025-08-09 20:21:45.015 WARNING in set_data_size_and_type result mime_type does not match, updating application/json application/vnd.msgpack
2025-08-09 20:21:45.015 INFO set done for e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f
2025-08-09 20:21:45.015 INFO {'cuopt_complete': -1}
2025-08-09 20:21:45.018 INFO Starting new process with pid 119834
2025-08-09 20:21:45.219 INFO solver rmm pool size in gigabytes 1 (GPU 0)
2025-08-09 20:21:45.219 INFO solver waiting on job queue (GPU 0)
2025-08-09 20:21:45.339 DEBUG job_result returning msgpack
2025-08-09 20:21:45.340 INFO 127.0.0.1:51850 - "GET /cuopt/solution/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f HTTP/1.1" 500
2025-08-09 20:21:45.348 INFO Extracting logs from log_e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f
2025-08-09 20:21:45.348 ERROR {'cuopt_trace': ['fastapi.exceptions.HTTPException: 404: log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f\n'], 'counter': 0, 'msg': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f'}
2025-08-09 20:21:45.348 ERROR {'cuopt_exception': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f', 'status_code': 404}
2025-08-09 20:21:45.349 INFO 127.0.0.1:51866 - "GET /cuopt/log/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f?frombyte=0 HTTP/1.1" 404
2025-08-09 20:21:45.353 INFO 127.0.0.1:51874 - "DELETE /cuopt/solution/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f HTTP/1.1" 200
2025-08-09 20:21:45.356 ERROR {'cuopt_trace': ['fastapi.exceptions.HTTPException: 404: log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f\n'], 'counter': 0, 'msg': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f'}
2025-08-09 20:21:45.357 ERROR {'cuopt_exception': 'log not found for request e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f', 'status_code': 404}
2025-08-09 20:21:45.357 INFO 127.0.0.1:51878 - "DELETE /cuopt/log/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f HTTP/1.1" 404
2025-08-09 20:22:15.249 INFO solver checking cuda health 120 time(s) per hour (GPU 0)

python代码输出

然后对应的python代码的输出如下所示:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
File /opt/anaconda3/envs/cuopt_env_2/lib/python3.10/site-packages/cuopt_sh_client/cuopt_self_host_client.py:518, in CuOptServiceSelfHostClient._poll_request(self, response, delete, incumbent_callback, logging_callback)512 response = requests.get(513     self.solution_url + f"/{reqId}",514     verify=self.verify,515     headers=headers,516     timeout=30,517 )
--> 518 response.raise_for_status()519 response = self._get_response(response)File /opt/anaconda3/envs/cuopt_env_2/lib/python3.10/site-packages/requests/models.py:1026, in Response.raise_for_status(self)1025 if http_error_msg:
-> 1026     raise HTTPError(http_error_msg, response=self)HTTPError: 500 Server Error: Internal Server Error for url: http://localhost:5000/cuopt/solution/e2b5b5fa-1401-4e9d-8e67-9aa81e931a1fDuring handling of the above exception, another exception occurred:ValueError                                Traceback (most recent call last)
Cell In[47], line 21 datas = ine_cons2datas(ine_constraints, ori_obj_coef, np.linspace(0,N,point_num*N+1).tolist())
----> 2 solutions = solve_cuOpt(datas,cuopt_service_client,log_callback=log_callback)3 # print("-"*10,"NORMAL MODE","-"*10)4 # print(json.dumps(solutions, indent=4))5 R_values = [solutions["response"]['solver_response'][i]["solution"]['primal_objective'] for i in range(len(solutions["response"]['solver_response']))]Cell In[44], line 2726 def solve_cuOpt(datas:list[dict], cuopt_service_client:CuOptServiceSelfHostClient,repoll_tries:int=2,log_callback = None):
---> 27     solution = cuopt_service_client.get_LP_solve(28         datas,29         response_type="dict",30         logging_callback=log_callback31     )32     solution = repoll(solution, repoll_tries)33     cuopt_service_client.close()File /opt/anaconda3/envs/cuopt_env_2/lib/python3.10/site-packages/cuopt_sh_client/cuopt_self_host_client.py:807, in CuOptServiceSelfHostClient.get_LP_solve(self, cuopt_data_models, solver_config, cache, response_type, filepath, output, delete_solution, warmstart_id, incumbent_callback, logging_callback)802 else:803     cuopt_problem_data = read_cuopt_problem_data(804         cuopt_data_models, filepath805     )
--> 807 res = self._send_request(808     cuopt_problem_data,809     filepath,810     cache,811     output,812     delete=delete_solution,813     warmstart_id=warmstart_id,814     incumbent_callback=incumbent_callback,815     logging_callback=logging_callback,816 )818 if response_type == "obj":819     return create_lp_response(self._cleanup_response(res))File /opt/anaconda3/envs/cuopt_env_2/lib/python3.10/site-packages/cuopt_sh_client/cuopt_self_host_client.py:607, in CuOptServiceSelfHostClient._send_request(self, cuopt_problem_data, filepath, cache, output, initial_ids, warmstart_id, delete, incumbent_callback, logging_callback)605 if cache:606     return self._get_response(response)
--> 607 return self._poll_request(608     response, delete, incumbent_callback, logging_callback609 )File /opt/anaconda3/envs/cuopt_env_2/lib/python3.10/site-packages/cuopt_sh_client/cuopt_self_host_client.py:525, in CuOptServiceSelfHostClient._poll_request(self, response, delete, incumbent_callback, logging_callback)521             log.debug(str(e))522             err, complete = self._handle_request_exception(523                 response, reqId524             )
--> 525             raise ValueError(err)526     return response528 finally:ValueError: cuOpt Error: Internal Server Error - 500: e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f was aborted
reqId: e2b5b5fa-1401-4e9d-8e67-9aa81e931a1f

python代码

此外原始的python代码是这样的。

datas = ine_cons2datas(ine_constraints, ori_obj_coef, np.linspace(0,N,point_num*N+1).tolist())
solutions = solve_cuOpt(datas,cuopt_service_client,log_callback=log_callback)
# print("-"*10,"NORMAL MODE","-"*10)
# print(json.dumps(solutions, indent=4))
R_values = [solutions["response"]['solver_response'][i]["solution"]['primal_objective'] for i in range(len(solutions["response"]['solver_response']))]
#assert len(R_values) == len(np.linspace(0,N,point_num*N+1).tolist())
print(len(R_values))
print(R_values)
print(np.linspace(0,N,point_num*N+1))from cuopt_sh_client import CuOptServiceSelfHostClient
import json
import time
from scipy.sparse import csr_matrix
def ine_cons2datas(ine_constraints:np.array, ori_obj_coef:np.array, M_values:list[int|float]):""" Data Format for Reference:param: ine_constraints: 最后一行是全0的表示的是等式约束M = M_value;而且此时的最后一行是F哦。:param: obj_coef: 目标函数的系数。data = {"csr_constraint_matrix": {"offsets": [0, 2, 4], # 第一行从0开始,第二行从2开始,以此类推。"indices": [0, 1, 0, 1], # 表示每行的非0元素的索引,也就是说,第1行是0,1都是非零元素,以此类推。"values": [3.0, 4.0, 2.7, 10.1] # 具体的每个系数的值。},"constraint_bounds": {"upper_bounds": [5.4, 4.9], # 上界。"lower_bounds": ["ninf", "ninf"] # 没有下界。},"objective_data": {"coefficients": [-0.2, 0.1],"scalability_factor": 1.0,"offset": 0.0 # 常数偏移,不知道是什么意思哎。},"variable_bounds": {"upper_bounds": ["inf", "inf"],"lower_bounds": [0.0, 0.0]},"maximize": False, # 最小化问题。"solver_config": {"tolerances": {"optimality": 0.0001}}}"""# 最后实现的有点奇怪了,具体而言就是去掉了最后一行,使用的是变量约束进行的计算。M_value = 0datas = []for M_value in M_values:# csr_constraint_matrixassert ine_constraints.shape[1] == ori_obj_coef.shape[0] + 1ine_only_ine_constraints = ine_constraints[:-1, :]variable_only_ine_constraints = ine_only_ine_constraints[:, :-1]offsets = csr_matrix(variable_only_ine_constraints).indptr.tolist()indices = csr_matrix(variable_only_ine_constraints).indices.tolist()values = csr_matrix(variable_only_ine_constraints).data.tolist()assert len(indices) == len(values)csr_constraint_matrix = {"offsets": offsets,"indices": indices,"values": values}# constraint_boundsconstraint_bounds = {"upper_bounds": ["inf"]*ine_only_ine_constraints.shape[0],"lower_bounds": ine_only_ine_constraints[:, -1].tolist()} # 最后的等式约束最后再加上。# objective_dataobjective_data = {"coefficients": ori_obj_coef.tolist(),"scalability_factor": 1.0,"offset": 0.0}# variable_boundsupper_bounds = ["inf"] * ori_obj_coef.shape[0]upper_bounds[-2] = M_valuelower_bounds = [0.0] * ori_obj_coef.shape[0]lower_bounds[-2] = M_valuevariable_bounds = {"upper_bounds": upper_bounds,"lower_bounds": lower_bounds}# datadata = {"csr_constraint_matrix": csr_constraint_matrix,"constraint_bounds": constraint_bounds,"objective_data": objective_data,"variable_bounds": variable_bounds,"maximize": False,"solver_config": {"tolerances": {"optimality": 0.0001}}}datas.append(data)# print(variable_only_ine_constraints)# print(offsets)# #print(offset)# print(csr_matrix(variable_only_ine_constraints).indices)# print(len(csr_matrix(variable_only_ine_constraints).indices))# print(len(list(offsets)))# print(values)# print(data)# print(json.dumps(data,indent=4))return datascuopt_service_client = CuOptServiceSelfHostClient(ip = "localhost",port = 5000,polling_timeout=600,timeout_exception=False # 永远不会超时异常
)
def repoll(solution, repoll_tries):"""应该是根据solution中是否存在正确的结果,而决定是不是进行重复轮询的操作。"""if "reqId" in solution and "response" not in solution:req_id = solution["reqId"]for i in range(repoll_tries):solution = cuopt_service_client.repoll(req_id,response_type="dict")if "reqId" in solution and "response" in solution:breaktime.sleep(1)return solution
# logging callback
def log_callback(log):"""打印日志信息。"""for i in log:print("server-log: ", log)
def solve_cuOpt(datas:list[dict], cuopt_service_client:CuOptServiceSelfHostClient,repoll_tries:int=2,log_callback = None):solution = cuopt_service_client.get_LP_solve(datas,response_type="dict",logging_callback=log_callback)solution = repoll(solution, repoll_tries)cuopt_service_client.close()return solution

参考示例代码(来自cuOpt官方nvidia)

其中求解问题的代码是我根据原来的示例自己写的。原来的示例如下所示:

from cuopt_sh_client import CuOptServiceSelfHostClient
import json
import time# example for LP problem
data = {"csr_constraint_matrix": {"offsets": [0, 2, 4], # 第一行从0开始,第二行从2开始,以此类推。"indices": [0, 1, 0, 1], # 表示每行的非0元素的索引,也就是说,第1行是0,1都是非零元素,以此类推。"values": [3.0, 4.0, 2.7, 10.1] # 具体的每个系数的值。},"constraint_bounds": {"upper_bounds": [5.4, 4.9], # 上界。"lower_bounds": ["ninf", "ninf"] # 没有下界。},"objective_data": {"coefficients": [-0.2, 0.1],"scalability_factor": 1.0,"offset": 0.0 # 常数偏移,不知道是什么意思哎。},"variable_bounds": {"upper_bounds": ["inf", "inf"],"lower_bounds": [0.0, 0.0]},"maximize": False, # 最小化问题。"solver_config": {"tolerances": {"optimality": 0.0001}}
}cuopt_service_client = CuOptServiceSelfHostClient(ip = "localhost",port = 5000,polling_timeout=10,timeout_exception=False # 永远不会超时异常
)
repoll_tries = 500
def repoll(solution, repoll_tries):"""应该是根据solution中是否存在正确的结果,而决定是不是进行重复轮询的操作。"""if "reqId" in solution and "response" not in solution:req_id = solution["reqId"]for i in range(repoll_tries):solution = cuopt_service_client.repoll(req_id,response_type="dict")if "reqId" in solution and "response" in solution:breaktime.sleep(1)return solution
# logging callback
def log_callback(log):"""打印日志信息。"""for i in log:print("server-log: ", log)
# 求解1
solution = cuopt_service_client.get_LP_solve(data,response_type="dict",logging_callback=log_callback
)
solution = repoll(solution, repoll_tries)
print("-"*10,"NORMAL MODE","-"*10)
print(json.dumps(solution, indent=4))
# 求解2
solution = cuopt_service_client.get_LP_solve([data,data],response_type="dict",logging_callback=log_callback
)
solution = repoll(solution, repoll_tries)
print("-"*10,"BATCH MODE","-"*10)
print(json.dumps(solution, indent=4))""" 输出效果示例
server-log:  ['']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['Solving a problem with 2 constraints 2 variables (0 integers) and 4 nonzeros', 'Objective offset 0.000000 scaling_factor 1.000000', 'Running concurrent', '', 'Dual simplex finished in 0.00 seconds', '   Iter    Primal Obj.      Dual Obj.    Gap        Primal Res.  Dual Res.   Time', '      0 +0.00000000e+00 +0.00000000e+00  0.00e+00   0.00e+00     2.00e-01   0.080s', 'PDLP finished', 'Concurrent time:  0.083s', 'Solved with dual simplex', 'Status: Optimal   Objective: -3.60000000e-01  Iterations: 1  Time: 0.083s', '']
server-log:  ['']
server-log:  ['']
server-log:  ['']
2025-08-06 16:07:13.087 cuopt_sh_client.cuopt_self_host_client INFO Optimal
---------- NORMAL MODE ----------
{"response": {"solver_response": {"status": 1,"solution": {"problem_category": 0,"primal_solution": [1.8,0.0],"dual_solution": [-0.06666666666666668,0.0],"primal_objective": -0.36000000000000004,"dual_objective": -0.36000000000000004,"solver_time": 0.08318305015563965,"solved_by_pdlp": false,"vars": {},"lp_statistics": {"primal_residual": 0.0,"dual_residual": 6.938893903907228e-18,"gap": 0.0,"nb_iterations": 1},"reduced_cost": [0.0,0.0031070813207920247],"milp_statistics": {}}},"total_solve_time": 0.3422067165374756},"reqId": "efd78833-6a22-4af9-ab52-92d553ed1949"
}
2025-08-06 16:07:15.123 cuopt_sh_client.cuopt_self_host_client INFO Optimal
2025-08-06 16:07:15.124 cuopt_sh_client.cuopt_self_host_client INFO Optimal
---------- BATCH MODE ----------
{"response": {"solver_response": [{"status": 1,"solution": {"problem_category": 0,"primal_solution": [1.8000000001652559,0.0],"dual_solution": [-0.06666666670916196,0.0],"primal_objective": -0.3600000000330512,"dual_objective": -0.36000000022947465,"solver_time": 0.057,"solved_by_pdlp": true,"vars": {},"lp_statistics": {"primal_residual": 4.957669830218947e-10,"dual_residual": 0.0,"gap": 1.9642343307424426e-10,"nb_iterations": 120},"reduced_cost": [1.2748588296140895e-10,0.36666666683664784],"milp_statistics": {}}},{"status": 1,"solution": {"problem_category": 0,"primal_solution": [1.8000000001652559,0.0],"dual_solution": [-0.06666666670916196,0.0],"primal_objective": -0.3600000000330512,"dual_objective": -0.36000000022947465,"solver_time": 0.052,"solved_by_pdlp": true,"vars": {},"lp_statistics": {"primal_residual": 4.957669830218947e-10,"dual_residual": 0.0,"gap": 1.9642343307424426e-10,"nb_iterations": 120},"reduced_cost": [1.2748588296140895e-10,0.36666666683664784],"milp_statistics": {}}}],"total_solve_time": 0.064},"reqId": "4300b618-fe94-4ad8-8bb3-725764cb97a5"
}"""

解决方案

在原有的solve_cuOpt的基础上添加一个关闭当前的问题的代码就解决了。这说明一定要注意及时关闭server上的任务、释放资源。一定程度上也是受了官方给出的代码的影响。
在这里插入图片描述

http://www.xdnf.cn/news/17390.html

相关文章:

  • 如何解决pip安装报错ModuleNotFoundError: No module named ‘fastai’问题
  • 面试题-----Spring Cloud
  • LLM 的向量的方向表示语义,向量长度表示什么
  • 强化学习笔记:从Q学习到GRPO
  • 1.JavaScript 介绍
  • Linux系统编程Day10 -- 进程管理
  • 分治-快排-面试题 17.14.最小k个数-力扣(LeetCode)
  • 在 Vue 中动态引入SVG图标的实现方案
  • Horse3D引擎研发笔记(三):使用QtOpenGL的Shader编程绘制彩色三角形
  • 第十九天-输入捕获实验
  • Redis面试题及详细答案100道(01-15) --- 基础认知篇
  • synchronized和RentrantLock用哪个?
  • LangChain-Unstructured 基础使用:PDF 与 Markdown 处理解析
  • 深入解析进程创建与终止机制
  • RAG-大模型课程《李宏毅 2025》作业1笔记
  • 算法篇----分治(快排)
  • 赛灵思ZYNQ官方文档UG585自学翻译笔记:General Purpose I/O (GPIO)通用输入 / 输出,LED控制亮灭,按键控制,中断控制
  • 【Mac】MLX:Lora微调工作流
  • 疯狂星期四文案网第34天运营日记
  • 第15届蓝桥杯Scratch图形化省赛中级组2024年8月24日真题
  • C++四种类型转换
  • 决策树技术详解:从理论到Python实战
  • 数据标准化与归一化的区别与应用场景
  • UE蓝图节点Add Impulse和Add Torque in Radians
  • Solana上Launchpad混战:新颖性应被重视
  • [激光原理与应用-201]:光学器件 - 增益晶体 - 概述
  • 大语言模型提示工程与应用:LLMs文本生成与数据标注实践
  • Java基础-TCP通信(多发多收和一发一收)
  • PHP-单引号和双引号(通俗易懂讲解版)
  • MySQL 元数据详细说明