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