Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
4ef3e774
Commit
4ef3e774
authored
Aug 22, 2016
by
Matthieu Schaller
Browse files
Better documentation of the task structure. All fields are now correctly labelled and documented.
parent
a3ba56c9
Changes
6
Hide whitespace changes
Inline
Side-by-side
examples/main.c
View file @
4ef3e774
...
...
@@ -535,7 +535,7 @@ int main(int argc, char *argv[]) {
if
(
!
e
.
sched
.
tasks
[
l
].
skip
&&
!
e
.
sched
.
tasks
[
l
].
implicit
)
{
fprintf
(
file_thread
,
" %03i %i %i %i %i %lli %lli %i %i %i %i %i
\n
"
,
myrank
,
e
.
sched
.
tasks
[
l
].
last_
rid
,
e
.
sched
.
tasks
[
l
].
type
,
myrank
,
e
.
sched
.
tasks
[
l
].
rid
,
e
.
sched
.
tasks
[
l
].
type
,
e
.
sched
.
tasks
[
l
].
subtype
,
(
e
.
sched
.
tasks
[
l
].
cj
==
NULL
),
e
.
sched
.
tasks
[
l
].
tic
,
e
.
sched
.
tasks
[
l
].
toc
,
(
e
.
sched
.
tasks
[
l
].
ci
!=
NULL
)
?
e
.
sched
.
tasks
[
l
].
ci
->
count
...
...
@@ -571,7 +571,7 @@ int main(int argc, char *argv[]) {
if
(
!
e
.
sched
.
tasks
[
l
].
skip
&&
!
e
.
sched
.
tasks
[
l
].
implicit
)
fprintf
(
file_thread
,
" %i %i %i %i %lli %lli %i %i %i %i
\n
"
,
e
.
sched
.
tasks
[
l
].
last_
rid
,
e
.
sched
.
tasks
[
l
].
type
,
e
.
sched
.
tasks
[
l
].
rid
,
e
.
sched
.
tasks
[
l
].
type
,
e
.
sched
.
tasks
[
l
].
subtype
,
(
e
.
sched
.
tasks
[
l
].
cj
==
NULL
),
e
.
sched
.
tasks
[
l
].
tic
,
e
.
sched
.
tasks
[
l
].
toc
,
(
e
.
sched
.
tasks
[
l
].
ci
==
NULL
)
?
0
:
e
.
sched
.
tasks
[
l
].
ci
->
count
,
...
...
src/runner.c
View file @
4ef3e774
...
...
@@ -1132,7 +1132,6 @@ void *runner_main(void *data) {
struct
cell
*
ci
=
t
->
ci
;
struct
cell
*
cj
=
t
->
cj
;
t
->
rid
=
r
->
cpuid
;
t
->
last_rid
=
r
->
cpuid
;
/* Different types of tasks... */
switch
(
t
->
type
)
{
...
...
@@ -1211,6 +1210,7 @@ void *runner_main(void *data) {
case
task_type_kick_fixdt
:
runner_do_kick_fixdt
(
r
,
ci
,
1
);
break
;
#ifdef WITH_MPI
case
task_type_send
:
if
(
t
->
subtype
==
task_subtype_tend
)
{
free
(
t
->
buff
);
...
...
@@ -1224,6 +1224,7 @@ void *runner_main(void *data) {
runner_do_recv_cell
(
r
,
ci
,
1
);
}
break
;
#endif
case
task_type_grav_mm
:
runner_do_grav_mm
(
r
,
t
->
ci
,
1
);
break
;
...
...
src/scheduler.c
View file @
4ef3e774
...
...
@@ -704,7 +704,6 @@ struct task *scheduler_addtask(struct scheduler *s, enum task_types type,
t
->
toc
=
0
;
t
->
nr_unlock_tasks
=
0
;
t
->
rid
=
-
1
;
t
->
last_rid
=
-
1
;
/* Add an index for it. */
// lock_lock( &s->lock );
...
...
src/task.c
View file @
4ef3e774
...
...
@@ -46,7 +46,6 @@
#include
"inline.h"
#include
"lock.h"
/* Task type names. */
const
char
*
taskID_names
[
task_type_count
]
=
{
"none"
,
"sort"
,
"self"
,
"pair"
,
"sub_self"
,
"sub_pair"
,
"init"
,
"ghost"
,
"extra_ghost"
,
"kick"
,
...
...
@@ -58,6 +57,9 @@ const char *subtaskID_names[task_subtype_count] = {
/**
* @brief Computes the overlap between the parts array of two given cells.
*
* @param ci The first #cell.
* @param cj The second #cell.
*/
__attribute__
((
always_inline
))
INLINE
static
size_t
task_cell_overlap_part
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
)
{
...
...
@@ -77,6 +79,9 @@ __attribute__((always_inline)) INLINE static size_t task_cell_overlap_part(
/**
* @brief Computes the overlap between the gparts array of two given cells.
*
* @param ci The first #cell.
* @param cj The second #cell.
*/
__attribute__
((
always_inline
))
INLINE
static
size_t
task_cell_overlap_gpart
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
)
{
...
...
src/task.h
View file @
4ef3e774
...
...
@@ -23,15 +23,15 @@
#ifndef SWIFT_TASK_H
#define SWIFT_TASK_H
#include
"../config.h"
/* Includes. */
#include
"cell.h"
#include
"cycle.h"
/* Some constants. */
#define task_maxwait 3
#define task_maxunlock 15
/* The different task types. */
/**
* @brief The different task types.
*/
enum
task_types
{
task_type_none
=
0
,
task_type_sort
,
...
...
@@ -54,9 +54,9 @@ enum task_types {
task_type_count
};
extern
const
char
*
taskID_names
[];
/* The different task sub-types.
*/
/**
* @brief The different task sub-types (for pairs, selfs and sub-tasks).
*/
enum
task_subtypes
{
task_subtype_none
=
0
,
task_subtype_density
,
...
...
@@ -67,7 +67,9 @@ enum task_subtypes {
task_subtype_count
};
/* The kind of action the task perform */
/**
* @brief The type of particles/objects this task acts upon in a given cell.
*/
enum
task_actions
{
task_action_none
,
task_action_part
,
...
...
@@ -77,29 +79,72 @@ enum task_actions {
task_action_count
};
/**
* @brief Names of the task types.
*/
extern
const
char
*
taskID_names
[];
/**
* @brief Names of the task sub-types.
*/
extern
const
char
*
subtaskID_names
[];
/* Data of a task. */
/**
* @brief A task to be run by the #scheduler.
*/
struct
task
{
/*! Type of the task */
enum
task_types
type
;
/*! Sub-type of the task (for the tasks that have one */
enum
task_subtypes
subtype
;
char
skip
,
tight
,
implicit
;
int
flags
,
wait
,
rank
,
weight
;
/*! Flags used to carry additional information (e.g. sort directions) */
int
flags
;
/*! Number of unsatisfied dependencies */
int
wait
;
/*! Rank of a task in the order */
int
rank
;
/*! Weight of the task */
int
weight
;
/*! Pointers to the cells this task acts upon */
struct
cell
*
ci
,
*
cj
;
void
*
buff
;
/*! ID of the queue or runner owning this task */
int
rid
;
/*! Number of tasks unlocked by this one */
int
nr_unlock_tasks
;
/*! List of tasks unlocked by this one */
struct
task
**
unlock_tasks
;
#ifdef WITH_MPI
/*! Buffer for this task's communications */
void
*
buff
;
/*! MPI request corresponding to this task */
MPI_Request
req
;
#endif
int
rid
,
last_rid
;
/*! Start and end time of this task */
ticks
tic
,
toc
;
int
nr_unlock_tasks
;
struct
task
**
unlock_tasks
;
/*! Should the scheduler skip this task ? */
char
skip
;
/*! Does this task require the particles to be tightly in the cell ? */
char
tight
;
/*! Is this task implicit (i.e. does not do anything) ? */
char
implicit
;
};
/* Function prototypes. */
...
...
src/units.h
View file @
4ef3e774
...
...
@@ -29,25 +29,26 @@
* @brief The unit system used internally.
*
* This structure contains the conversion factors to the 7 cgs base units to the
*internal units.
* It is used everytime a conversion is performed or an i/o function is called.
*
* internal units. It is used everytime a conversion is performed or an i/o
* function is called.
**/
struct
UnitSystem
{
double
UnitMass_in_cgs
;
/*< Conversion factor from grams to internal mass
units */
double
UnitLength_in_cgs
;
/*< Conversion factor from centimeters to internal
length units. */
/*! Conversion factor from grams to internal mass units */
double
UnitMass_in_cgs
;
/*! Conversion factor from centimeters to internal length unit */
double
UnitLength_in_cgs
;
double
UnitTime_in_cgs
;
/*
<
Conversion factor from seconds to internal time
units. */
/*
!
Conversion factor from seconds to internal time
units */
double
UnitTime_in_cgs
;
double
UnitCurrent_in_cgs
;
/*
<
Conversion factor from Ampere to internal
current units. */
/*
!
Conversion factor from Ampere to internal
current units */
double
UnitCurrent_in_cgs
;
double
UnitTemperature_in_cgs
;
/*< Conversion factor from Kelvins to internal
temperature units. */
/*! Conversion factor from Kelvins to internal temperature units. */
double
UnitTemperature_in_cgs
;
};
/**
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment