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
b9232db9
Commit
b9232db9
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
add an initial implementation.
parent
d7cd3ff8
No related branches found
No related tags found
1 merge request
!176
Tasks cleanup
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Makefile.am
+3
-2
3 additions, 2 deletions
src/Makefile.am
src/threadpool.h
+12
-5
12 additions, 5 deletions
src/threadpool.h
with
15 additions
and
7 deletions
src/Makefile.am
+
3
−
2
View file @
b9232db9
...
...
@@ -36,14 +36,15 @@ endif
include_HEADERS
=
space.h runner.h queue.h task.h lock.h cell.h part.h const.h
\
engine.h swift.h serial_io.h timers.h debug.h scheduler.h proxy.h parallel_io.h
\
common_io.h single_io.h multipole.h map.h tools.h partition.h clocks.h parser.h
\
physical_constants.h physical_constants_cgs.h potentials.h version.h hydro_properties.h
physical_constants.h physical_constants_cgs.h potentials.h version.h
\
hydro_properties.h threadpool.h
# Common source files
AM_SOURCES
=
space.c runner.c queue.c task.c cell.c engine.c
\
serial_io.c timers.c debug.c scheduler.c proxy.c parallel_io.c
\
units.c common_io.c single_io.c multipole.c version.c map.c
\
kernel_hydro.c kernel_gravity.c tools.c part.c partition.c clocks.c parser.c
\
physical_constants.c potentials.c hydro_properties.c
physical_constants.c potentials.c hydro_properties.c
threadpool.c
# Include files for distribution, not installation.
nobase_noinst_HEADERS
=
approx_math.h atomic.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h
\
...
...
This diff is collapsed.
Click to expand it.
src/threadpool.h
+
12
−
5
View file @
b9232db9
...
...
@@ -25,6 +25,9 @@
/* Some standard headers. */
#include
<pthread.h>
/* Function type for mappings. */
typedef
void
(
*
threadpool_map_function
)(
void
*
map_data
,
void
*
extra_data
);
/* Data of a threadpool. */
struct
threadpool
{
...
...
@@ -35,17 +38,21 @@ struct threadpool {
pthread_t
*
threads
;
/* This is where threads go to rest. */
pthread_mutex_t
sleep
_mutex
;
pthread_cond_t
sleep
_cond
;
pthread_mutex_t
control_mutex
,
thread
_mutex
;
pthread_cond_t
control_cond
,
thread
_cond
;
/* Current map data and count. */
void
*
map_data
;
size_t
map_data_count
,
map_data_size
,
map_data_stride
;
threadpool_map_function
map_function
;
/* Counter for the number of threads that are done. */
int
num_threads_done
;
};
/* Function prototypes. */
void
threadpool_init
(
struct
threadpool
*
tp
,
int
num_threads
);
void
threadpool_map
(
struct
threadpool
*
tp
,
void
*
map_data
,
size_t
N
,
int
stride
,
void
*
extra_data
);
void
threadpool_map
(
struct
threadpool
*
tp
,
threadpool_map_function
map_function
,
void
*
map_data
,
size_t
N
,
int
stride
,
void
*
extra_data
);
#endif
/* SWIFT_THREADPOOL_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