task.h 2.62 KB
Newer Older
1
/*******************************************************************************
2
 * This file is part of SWIFT.
3
 * Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
4
 *                    Matthieu Schaller (matthieu.schaller@durham.ac.uk)
5
6
7
 *               2015 Peter W. Draper (p.w.draper@durham.ac.uk)
 *               2016 John A. Regan (john.a.regan@durham.ac.uk)
 *                    Tom Theuns (tom.theuns@durham.ac.uk)
8
 *
9
10
11
12
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
13
 *
14
15
16
17
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
18
 *
19
20
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 ******************************************************************************/
23
24
#ifndef SWIFT_TASK_H
#define SWIFT_TASK_H
25

26
27
/* Includes. */
#include "cell.h"
28
#include "cycle.h"
29

30
/* Some constants. */
31
#define task_maxwait 3
32
#define task_maxunlock 15
33

34
35
/* The different task types. */
enum task_types {
36
37
38
39
  task_type_none = 0,
  task_type_sort,
  task_type_self,
  task_type_pair,
40
41
  task_type_sub_self,
  task_type_sub_pair,
Matthieu Schaller's avatar
Matthieu Schaller committed
42
  task_type_init,
43
  task_type_ghost,
Matthieu Schaller's avatar
Matthieu Schaller committed
44
  task_type_kick,
45
  task_type_kick_fixdt,
46
47
48
49
50
51
  task_type_send,
  task_type_recv,
  task_type_grav_pp,
  task_type_grav_mm,
  task_type_grav_up,
  task_type_grav_down,
Tom Theuns's avatar
Tom Theuns committed
52
  task_type_grav_external,
53
54
55
  task_type_count
};

56
extern const char *taskID_names[];
57

58
59
/* The different task sub-types. */
enum task_subtypes {
60
61
62
63
  task_subtype_none = 0,
  task_subtype_density,
  task_subtype_force,
  task_subtype_grav,
64
  task_subtype_tend,
65
66
67
  task_subtype_count
};

68
extern const char *subtaskID_names[];
69

70
71
72
/* Data of a task. */
struct task {

73
74
75
76
77
78
  enum task_types type;
  enum task_subtypes subtype;
  char skip, tight, implicit;
  int flags, wait, rank, weight;

  struct cell *ci, *cj;
79

80
81
  void *buff;

82
83
84
#ifdef WITH_MPI
  MPI_Request req;
#endif
85

86
  int rid, last_rid;
87
88
89
  ticks tic, toc;

  int nr_unlock_tasks;
90
  struct task **unlock_tasks;
91
};
92
93

/* Function prototypes. */
94
void task_unlock(struct task *t);
95
float task_overlap(const struct task *ta, const struct task *tb);
96
int task_lock(struct task *t);
97
void task_print_mask(unsigned int mask);
98
void task_print_submask(unsigned int submask);
99
void task_do_rewait(struct task *t);
100
101

#endif /* SWIFT_TASK_H */