Skip to content

Commit d4f9530

Browse files
committed
Add switch to use thread-safe metis
1 parent 9a4e615 commit d4f9530

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

highs/ipm/hipo/factorhighs/Analyse.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,27 @@ Int Analyse::getPermutation() {
105105
}
106106

107107
// call Metis
108+
Int metis_seed = 42;
109+
108110
Int options[METIS_NOPTIONS];
109111
METIS_SetDefaultOptions(options);
110112
// fix seed of rng inside Metis, to make it deterministic (?)
111-
options[METIS_OPTION_SEED] = 42;
113+
options[METIS_OPTION_SEED] = metis_seed;
112114

113115
// set logging of Metis depending on debug level
114116
options[METIS_OPTION_DBGLVL] = 0;
115117
if (log_->debug(2))
116118
options[METIS_OPTION_DBGLVL] = METIS_DBG_INFO | METIS_DBG_COARSEN;
117119

118120
if (log_) log_->printDevInfo("Running Metis\n");
121+
#ifdef METIS_THREAD_SAFE
122+
unsigned rng_state = metis_seed;
123+
Int status = METIS_NodeND(&n_, temp_ptr.data(), temp_rows.data(), NULL,
124+
options, perm_.data(), iperm_.data(), &rng_state);
125+
#else
119126
Int status = METIS_NodeND(&n_, temp_ptr.data(), temp_rows.data(), NULL,
120127
options, perm_.data(), iperm_.data());
128+
#endif
121129
if (log_) log_->printDevInfo("Metis done\n");
122130
if (status != METIS_OK) {
123131
if (log_) log_->printDevInfo("Error with Metis\n");

0 commit comments

Comments
 (0)