@@ -104,28 +104,32 @@ Int Analyse::getPermutation() {
104104 }
105105 }
106106
107- // call Metis
108- Int metis_seed = 42 ;
109-
110107 Int options[METIS_NOPTIONS];
111108 METIS_SetDefaultOptions (options);
112- // fix seed of rng inside Metis, to make it deterministic (?)
113- options[METIS_OPTION_SEED] = metis_seed;
109+ options[METIS_OPTION_SEED] = kMetisSeed ;
114110
115111 // set logging of Metis depending on debug level
116112 options[METIS_OPTION_DBGLVL] = 0 ;
117113 if (log_->debug (2 ))
118114 options[METIS_OPTION_DBGLVL] = METIS_DBG_INFO | METIS_DBG_COARSEN;
119115
120116 if (log_) log_->printDevInfo (" Running Metis\n " );
117+
121118#ifdef METIS_THREAD_SAFE
122- unsigned rng_state = metis_seed;
119+ // Thread-safe version of Metis that stores state of random-number generator
120+ // in local variable.
121+ if (log_) log_->printDevInfo (" Using thread-safe Metis\n " );
122+ unsigned rng_state = kMetisSeed ;
123123 Int status = METIS_NodeND (&n_, temp_ptr.data (), temp_rows.data (), NULL ,
124124 options, perm_.data (), iperm_.data (), &rng_state);
125125#else
126+ // Default version of Metis. This gives non-deterministic results if multiple
127+ // matrices are reordered concurrently.
128+ if (log_) log_->printDevInfo (" Using non-thread-safe Metis\n " );
126129 Int status = METIS_NodeND (&n_, temp_ptr.data (), temp_rows.data (), NULL ,
127130 options, perm_.data (), iperm_.data ());
128131#endif
132+
129133 if (log_) log_->printDevInfo (" Metis done\n " );
130134 if (status != METIS_OK) {
131135 if (log_) log_->printDevInfo (" Error with Metis\n " );
0 commit comments