Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
51be5fa8
Commit
51be5fa8
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
No unwanted post-merge changes.
parent
31730730
No related branches found
No related tags found
1 merge request
!266
Cube root
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/EAGLE_12/eagle_12.yml
+0
-5
0 additions, 5 deletions
examples/EAGLE_12/eagle_12.yml
src/engine.c
+421
-336
421 additions, 336 deletions
src/engine.c
src/threadpool.c
+15
-7
15 additions, 7 deletions
src/threadpool.c
with
436 additions
and
348 deletions
examples/EAGLE_12/eagle_12.yml
+
0
−
5
View file @
51be5fa8
...
@@ -6,11 +6,6 @@ InternalUnitSystem:
...
@@ -6,11 +6,6 @@ InternalUnitSystem:
UnitCurrent_in_cgs
:
1
# Amperes
UnitCurrent_in_cgs
:
1
# Amperes
UnitTemp_in_cgs
:
1
# Kelvin
UnitTemp_in_cgs
:
1
# Kelvin
# Parameters for the task scheduling
Scheduler
:
cell_sub_size
:
6000
# Value used for the original scaling tests
cell_split_size
:
300
# Value used for the original scaling tests
# Parameters governing the time integration
# Parameters governing the time integration
TimeIntegration
:
TimeIntegration
:
time_begin
:
0.
# The starting time of the simulation (in internal units).
time_begin
:
0.
# The starting time of the simulation (in internal units).
...
...
This diff is collapsed.
Click to expand it.
src/engine.c
+
421
−
336
View file @
51be5fa8
This diff is collapsed.
Click to expand it.
src/threadpool.c
+
15
−
7
View file @
51be5fa8
...
@@ -59,14 +59,22 @@ void *threadpool_runner(void *data) {
...
@@ -59,14 +59,22 @@ void *threadpool_runner(void *data) {
pthread_mutex_unlock
(
&
tp
->
thread_mutex
);
pthread_mutex_unlock
(
&
tp
->
thread_mutex
);
/* The index of the mapping task we will work on next. */
/* The index of the mapping task we will work on next. */
size_t
task_ind
;
while
(
1
)
{
while
((
task_ind
=
atomic_add
(
&
tp
->
map_data_count
,
tp
->
map_data_chunk
))
<
/* Desired chunk size. */
tp
->
map_data_size
)
{
size_t
chunk_size
=
const
int
num_elements
=
task_ind
+
tp
->
map_data_chunk
>
tp
->
map_data_size
(
tp
->
map_data_size
-
tp
->
map_data_count
)
/
(
2
*
tp
->
num_threads
);
?
tp
->
map_data_size
-
task_ind
if
(
chunk_size
>
tp
->
map_data_chunk
)
chunk_size
=
tp
->
map_data_chunk
;
:
tp
->
map_data_chunk
;
if
(
chunk_size
<
1
)
chunk_size
=
1
;
/* Get a chunk and check its size. */
size_t
task_ind
=
atomic_add
(
&
tp
->
map_data_count
,
chunk_size
);
if
(
task_ind
>=
tp
->
map_data_size
)
break
;
if
(
task_ind
+
chunk_size
>
tp
->
map_data_size
)
chunk_size
=
tp
->
map_data_size
-
task_ind
;
/* Call the mapper function. */
tp
->
map_function
((
char
*
)
tp
->
map_data
+
(
tp
->
map_data_stride
*
task_ind
),
tp
->
map_function
((
char
*
)
tp
->
map_data
+
(
tp
->
map_data_stride
*
task_ind
),
num_elements
,
tp
->
map_extra_data
);
chunk_size
,
tp
->
map_extra_data
);
}
}
}
}
}
}
...
...
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