Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JPScore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JuPedSim
JPScore
Commits
cc87deac
Commit
cc87deac
authored
Jun 29, 2016
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix thread distribution for Gompertz and GCFM
parent
19a55d39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
math/GCFMModel.cpp
math/GCFMModel.cpp
+8
-4
math/GompertzModel.cpp
math/GompertzModel.cpp
+5
-5
No files found.
math/GCFMModel.cpp
View file @
cc87deac
...
@@ -144,7 +144,11 @@ void GCFMModel::ComputeNextTimeStep(double current, double deltaT, Building* bui
...
@@ -144,7 +144,11 @@ void GCFMModel::ComputeNextTimeStep(double current, double deltaT, Building* bui
int
nThreads
=
omp_get_max_threads
();
int
nThreads
=
omp_get_max_threads
();
int
partSize
=
nSize
/
nThreads
;
int
partSize
;
partSize
=
((
int
)
nSize
>
nThreads
)
?
(
int
)
(
nSize
/
nThreads
)
:
(
int
)
nSize
;
if
(
partSize
==
(
int
)
nSize
)
nThreads
=
1
;
// not worthy to parallelize
int
debugPed
=
-
10
;
int
debugPed
=
-
10
;
//building->GetGrid()->HighlightNeighborhood(debugPed, building);
//building->GetGrid()->HighlightNeighborhood(debugPed, building);
#pragma omp parallel default(shared) num_threads(nThreads)
#pragma omp parallel default(shared) num_threads(nThreads)
...
@@ -155,8 +159,8 @@ void GCFMModel::ComputeNextTimeStep(double current, double deltaT, Building* bui
...
@@ -155,8 +159,8 @@ void GCFMModel::ComputeNextTimeStep(double current, double deltaT, Building* bui
const
int
threadID
=
omp_get_thread_num
();
const
int
threadID
=
omp_get_thread_num
();
int
start
=
threadID
*
partSize
;
int
start
=
threadID
*
partSize
;
int
end
=
(
threadID
+
1
)
*
partSize
-
1
;
int
end
;
if
((
threadID
==
nThreads
-
1
))
end
=
nSize
-
1
;
end
=
(
threadID
<
nThreads
-
1
)
?
(
threadID
+
1
)
*
partSize
-
1
:
(
int
)
(
nSize
-
1
)
;
for
(
int
p
=
start
;
p
<=
end
;
++
p
)
{
for
(
int
p
=
start
;
p
<=
end
;
++
p
)
{
...
@@ -227,7 +231,7 @@ void GCFMModel::ComputeNextTimeStep(double current, double deltaT, Building* bui
...
@@ -227,7 +231,7 @@ void GCFMModel::ComputeNextTimeStep(double current, double deltaT, Building* bui
result_acc
.
push_back
(
acc
);
result_acc
.
push_back
(
acc
);
}
}
//
#pragma omp barrier
#pragma omp barrier
// update
// update
for
(
int
p
=
start
;
p
<=
end
;
++
p
)
{
for
(
int
p
=
start
;
p
<=
end
;
++
p
)
{
Pedestrian
*
ped
=
allPeds
[
p
];
Pedestrian
*
ped
=
allPeds
[
p
];
...
...
math/GompertzModel.cpp
View file @
cc87deac
...
@@ -149,7 +149,9 @@ void GompertzModel::ComputeNextTimeStep(double current, double deltaT, Building
...
@@ -149,7 +149,9 @@ void GompertzModel::ComputeNextTimeStep(double current, double deltaT, Building
int
nThreads
=
omp_get_max_threads
();
int
nThreads
=
omp_get_max_threads
();
int
partSize
;
int
partSize
;
partSize
=
(
int
)
(
nSize
/
nThreads
);
partSize
=
((
int
)
nSize
>
nThreads
)
?
(
int
)
(
nSize
/
nThreads
)
:
(
int
)
nSize
;
if
(
partSize
==
(
int
)
nSize
)
nThreads
=
1
;
// not worthy to parallelize
#pragma omp parallel default(shared) num_threads(nThreads)
#pragma omp parallel default(shared) num_threads(nThreads)
{
{
...
@@ -160,9 +162,7 @@ void GompertzModel::ComputeNextTimeStep(double current, double deltaT, Building
...
@@ -160,9 +162,7 @@ void GompertzModel::ComputeNextTimeStep(double current, double deltaT, Building
int
start
=
threadID
*
partSize
;
int
start
=
threadID
*
partSize
;
int
end
;
int
end
;
end
=
(
threadID
+
1
)
*
partSize
-
1
;
end
=
(
threadID
<
nThreads
-
1
)
?
(
threadID
+
1
)
*
partSize
-
1
:
(
int
)
(
nSize
-
1
);
if
((
threadID
==
nThreads
-
1
))
end
=
(
int
)
(
nSize
-
1
);
for
(
int
p
=
start
;
p
<=
end
;
++
p
)
{
for
(
int
p
=
start
;
p
<=
end
;
++
p
)
{
Pedestrian
*
ped
=
allPeds
[
p
];
Pedestrian
*
ped
=
allPeds
[
p
];
...
@@ -229,7 +229,7 @@ void GompertzModel::ComputeNextTimeStep(double current, double deltaT, Building
...
@@ -229,7 +229,7 @@ void GompertzModel::ComputeNextTimeStep(double current, double deltaT, Building
result_acc
.
push_back
(
acc
);
result_acc
.
push_back
(
acc
);
}
}
//
#pragma omp barrier
#pragma omp barrier
// update
// update
for
(
int
p
=
start
;
p
<=
end
;
++
p
)
{
for
(
int
p
=
start
;
p
<=
end
;
++
p
)
{
Pedestrian
*
ped
=
allPeds
[
p
];
Pedestrian
*
ped
=
allPeds
[
p
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment