Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
49e9f148
Unverified
Commit
49e9f148
authored
7 years ago
by
Yurov, Dmitry
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request
#402
from gpospelov/develop
Fixed multithreading with n_threads>9
parents
fd2b38ec
4e8e96a4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/coregui/Models/SimulationOptionsItem.cpp
+9
-8
9 additions, 8 deletions
GUI/coregui/Models/SimulationOptionsItem.cpp
GUI/coregui/Models/SimulationOptionsItem.h
+2
-0
2 additions, 0 deletions
GUI/coregui/Models/SimulationOptionsItem.h
with
11 additions
and
8 deletions
GUI/coregui/Models/SimulationOptionsItem.cpp
+
9
−
8
View file @
49e9f148
...
@@ -100,10 +100,7 @@ SimulationOptionsItem::SimulationOptionsItem()
...
@@ -100,10 +100,7 @@ SimulationOptionsItem::SimulationOptionsItem()
int
SimulationOptionsItem
::
getNumberOfThreads
()
const
int
SimulationOptionsItem
::
getNumberOfThreads
()
const
{
{
ComboProperty
combo
=
getItemValue
(
P_NTHREADS
).
value
<
ComboProperty
>
();
ComboProperty
combo
=
getItemValue
(
P_NTHREADS
).
value
<
ComboProperty
>
();
foreach
(
QChar
ch
,
combo
.
getValue
())
{
return
m_text_to_nthreads
[
combo
.
getValue
()];
if
(
ch
.
isDigit
())
return
ch
.
digitValue
();
}
return
0
;
}
}
bool
SimulationOptionsItem
::
runImmediately
()
const
bool
SimulationOptionsItem
::
runImmediately
()
const
...
@@ -181,16 +178,20 @@ QString SimulationOptionsItem::runPolicy() const
...
@@ -181,16 +178,20 @@ QString SimulationOptionsItem::runPolicy() const
//! returns list with number of threads to select
//! returns list with number of threads to select
QStringList
SimulationOptionsItem
::
getCPUUsageOptions
()
QStringList
SimulationOptionsItem
::
getCPUUsageOptions
()
{
{
m_text_to_nthreads
.
clear
();
QStringList
result
;
QStringList
result
;
int
nthreads
=
std
::
thread
::
hardware_concurrency
();
int
nthreads
=
std
::
thread
::
hardware_concurrency
();
for
(
int
i
=
nthreads
;
i
>
0
;
i
--
){
for
(
int
i
=
nthreads
;
i
>
0
;
i
--
){
QString
str
;
if
(
i
==
nthreads
)
{
if
(
i
==
nthreads
)
{
result
.
append
(
QString
(
"Max (%1 threads)"
).
arg
(
QString
::
number
(
i
))
)
;
str
=
QString
(
"Max (%1 threads)"
).
arg
(
QString
::
number
(
i
));
}
else
if
(
i
==
1
)
{
}
else
if
(
i
==
1
)
{
result
.
append
(
QString
(
"%1 thread"
).
arg
(
QString
::
number
(
i
))
)
;
str
=
QString
(
"%1 thread"
).
arg
(
QString
::
number
(
i
));
}
else
{
}
else
{
result
.
append
(
QString
(
"%1 threads"
).
arg
(
QString
::
number
(
i
))
)
;
str
=
QString
(
"%1 threads"
).
arg
(
QString
::
number
(
i
));
}
}
result
.
append
(
str
);
m_text_to_nthreads
[
str
]
=
i
;
}
}
return
result
;
return
result
;
}
}
This diff is collapsed.
Click to expand it.
GUI/coregui/Models/SimulationOptionsItem.h
+
2
−
0
View file @
49e9f148
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#define SIMULATIONOPTIONSITEM_H
#define SIMULATIONOPTIONSITEM_H
#include
"SessionItem.h"
#include
"SessionItem.h"
#include
<QMap>
//! The SimulationOptionsItem class holds simulation status (run policy, number of threads,
//! The SimulationOptionsItem class holds simulation status (run policy, number of threads,
//! integration flag). Used in SimulationView to define job settings. When job is started,
//! integration flag). Used in SimulationView to define job settings. When job is started,
...
@@ -54,6 +55,7 @@ public:
...
@@ -54,6 +55,7 @@ public:
private:
private:
QString
runPolicy
()
const
;
QString
runPolicy
()
const
;
QStringList
getCPUUsageOptions
();
QStringList
getCPUUsageOptions
();
QMap
<
QString
,
int
>
m_text_to_nthreads
;
};
};
#endif // SIMULATIONOPTIONSITEM_H
#endif // SIMULATIONOPTIONSITEM_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment