display number of threads in use for LAMMPS instance in status bar
This commit is contained in:
@ -161,7 +161,7 @@ void ImageViewer::updateActions()
|
||||
void ImageViewer::scaleImage(double factor)
|
||||
{
|
||||
scaleFactor *= factor;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
imageLabel->resize(scaleFactor * imageLabel->pixmap()->size());
|
||||
#else
|
||||
imageLabel->resize(scaleFactor * imageLabel->pixmap(Qt::ReturnByValue).size());
|
||||
|
||||
@ -79,14 +79,16 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
||||
|
||||
#if defined(_OPENMP)
|
||||
// use maximum number of available threads unless OMP_NUM_THREADS was set
|
||||
auto nthreads = std::to_string(omp_get_max_threads());
|
||||
nthreads = omp_get_max_threads();
|
||||
#if _WIN32
|
||||
if (!getenv("OMP_NUM_THREADS")) {
|
||||
_putenv_s("OMP_NUM_THREADS", nthreads.c_str());
|
||||
_putenv_s("OMP_NUM_THREADS", std::to_string(nthreads).c_str());
|
||||
}
|
||||
#else
|
||||
setenv("OMP_NUM_THREADS", nthreads.c_str(), 0);
|
||||
setenv("OMP_NUM_THREADS", std::to_string(nthreads).c_str(), 0);
|
||||
#endif
|
||||
#else
|
||||
nthreads = 1;
|
||||
#endif
|
||||
|
||||
const char *tmpdir = getenv("TMPDIR");
|
||||
@ -144,7 +146,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
||||
#endif
|
||||
|
||||
status = new QLabel("Ready.");
|
||||
status->setFixedWidth(250);
|
||||
status->setFixedWidth(300);
|
||||
ui->statusbar->addWidget(status);
|
||||
dirstatus = new QLabel(QString(" Directory: ") + current_dir);
|
||||
dirstatus->setMinimumWidth(500);
|
||||
@ -468,7 +470,7 @@ void LammpsGui::run_buffer()
|
||||
progress->setValue(0);
|
||||
dirstatus->hide();
|
||||
progress->show();
|
||||
status->setText("Running LAMMPS. Please wait...");
|
||||
status->setText(QString("Running LAMMPS with %1 thread(s)...").arg(nthreads));
|
||||
status->repaint();
|
||||
start_lammps();
|
||||
if (!lammps_handle) return;
|
||||
|
||||
@ -92,6 +92,7 @@ private:
|
||||
void *plugin_handle;
|
||||
const char *plugin_path;
|
||||
bool is_running;
|
||||
int nthreads;
|
||||
std::vector<char *> recent_files;
|
||||
std::vector<char *> lammps_args;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user