Skip to content

Commit 7ad21be

Browse files
committed
switch to SCIPtpiIsAvailable() in SCIPsolveConcurrent()
- and fix lint warnings that became visible now
1 parent 3bfbe9e commit 7ad21be

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/scip/scip_solve.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
#include "scip/tree.h"
113113
#include "scip/var.h"
114114
#include "scip/visual.h"
115+
#include "tpi/tpi.h"
115116

116117
/** calculates number of nonzeros in problem */
117118
static
@@ -2861,10 +2862,6 @@ SCIP_RETCODE SCIPsolveConcurrent(
28612862
SCIP* scip /**< SCIP data structure */
28622863
)
28632864
{
2864-
#ifdef TPI_NONE
2865-
SCIPerrorMessage("SCIP was compiled without task processing interface. Concurrent solve not possible\n");
2866-
return SCIP_PLUGINNOTFOUND;
2867-
#else
28682865
SCIP_RETCODE retcode;
28692866
int i;
28702867
SCIP_RANDNUMGEN* rndgen;
@@ -2873,7 +2870,13 @@ SCIP_RETCODE SCIPsolveConcurrent(
28732870

28742871
SCIP_CALL( SCIPcheckStage(scip, "SCIPsolveConcurrent", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
28752872

2876-
SCIP_CALL( SCIPsetIntParam(scip, "timing/clocktype", SCIP_CLOCKTYPE_WALL) );
2873+
if( !SCIPtpiIsAvailable() )
2874+
{
2875+
SCIPerrorMessage("SCIP was compiled without task processing interface. Concurrent solve not possible\n");
2876+
return SCIP_PLUGINNOTFOUND;
2877+
}
2878+
2879+
SCIP_CALL( SCIPsetIntParam(scip, "timing/clocktype", (int)SCIP_CLOCKTYPE_WALL) );
28772880

28782881
minnthreads = scip->set->parallel_minnthreads;
28792882
maxnthreads = scip->set->parallel_maxnthreads;
@@ -2887,7 +2890,7 @@ SCIP_RETCODE SCIPsolveConcurrent(
28872890
{
28882891
int nconcsolvertypes;
28892892
SCIP_CONCSOLVERTYPE** concsolvertypes;
2890-
SCIP_Longint nthreads;
2893+
int nthreads;
28912894
SCIP_Real memorylimit;
28922895
int* solvertypes;
28932896
SCIP_Longint* weights;
@@ -2933,8 +2936,8 @@ SCIP_RETCODE SCIPsolveConcurrent(
29332936
/* estimate maximum number of copies that be created based on memory limit */
29342937
if( !scip->set->misc_avoidmemout )
29352938
{
2936-
nthreads = MAX(1, memorylimit / (4.0*SCIPgetMemExternEstim(scip)/1048576.0));
2937-
SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "estimated a maximum of %lli threads based on memory limit\n", nthreads);
2939+
nthreads = MAX(1, memorylimit / (4.0*SCIPgetMemExternEstim(scip)/1048576.0)); /*lint !e666 !e524*/
2940+
SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "estimated a maximum of %d threads based on memory limit\n", nthreads);
29382941
}
29392942
else
29402943
{
@@ -2962,14 +2965,15 @@ SCIP_RETCODE SCIPsolveConcurrent(
29622965
return SCIPsolve(scip);
29632966
}
29642967
nthreads = MIN(nthreads, maxnthreads);
2965-
SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "using %lli threads for concurrent solve\n", nthreads);
2968+
SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "using %d threads for concurrent solve\n", nthreads);
29662969

29672970
/* now set up nthreads many concurrent solvers that will be used for the concurrent solve
29682971
* using the preferred priorities of each concurrent solver
29692972
*/
29702973
prefpriosum = 0.0;
29712974
for( i = 0; i < nconcsolvertypes; ++i )
29722975
prefpriosum += SCIPconcsolverTypeGetPrefPrio(concsolvertypes[i]);
2976+
assert(prefpriosum != 0.0);
29732977

29742978
ncandsolvertypes = 0;
29752979
SCIP_CALL( SCIPallocBufferArray(scip, &solvertypes, nthreads + nconcsolvertypes) );
@@ -3005,7 +3009,7 @@ SCIP_RETCODE SCIPsolveConcurrent(
30053009

30063010
SCIP_CALL( SCIPconcsolverCreateInstance(scip->set, concsolvertypes[solvertypes[i]], &concsolver) );
30073011
if( scip->set->concurrent_changeseeds && SCIPgetNConcurrentSolvers(scip) > 1 )
3008-
SCIP_CALL( SCIPconcsolverInitSeeds(concsolver, SCIPrandomGetInt(rndgen, 0, INT_MAX)) );
3012+
SCIP_CALL( SCIPconcsolverInitSeeds(concsolver, (unsigned int)SCIPrandomGetInt(rndgen, 0, INT_MAX)) );
30093013
}
30103014
SCIPfreeRandom(scip, &rndgen);
30113015
SCIPfreeBufferArray(scip, &prios);
@@ -3029,7 +3033,6 @@ SCIP_RETCODE SCIPsolveConcurrent(
30293033
SCIP_CALL( displayRelevantStats(scip) );
30303034

30313035
return retcode;
3032-
#endif
30333036
}
30343037

30353038
/** include specific heuristics and branching rules for reoptimization

0 commit comments

Comments
 (0)