runner.h 2.07 KB
Newer Older
1
/*******************************************************************************
2
 * This file is part of SWIFT.
3
 * Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
4
 *
5
6
7
8
 * 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.
9
 *
10
11
12
13
 * 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.
14
 *
15
16
 * 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/>.
17
 *
18
 ******************************************************************************/
19
20
#ifndef SWIFT_RUNNER_H
#define SWIFT_RUNNER_H
21

22
23
/* Includes. */
#include "cell.h"
24
#include "inline.h"
25

26
27
extern const float runner_shift[13 * 3];
extern const char runner_flip[27];
Pedro Gonnet's avatar
Pedro Gonnet committed
28
29

/* A struct representing a runner's thread and its data. */
Pedro Gonnet's avatar
Pedro Gonnet committed
30
struct runner {
Pedro Gonnet's avatar
Pedro Gonnet committed
31

32
33
  /* The id of this thread. */
  int id;
Pedro Gonnet's avatar
Pedro Gonnet committed
34

35
36
  /* The thread which it is running. */
  pthread_t thread;
37

38
39
  /* The queue to use to get tasks. */
  int cpuid, qid;
Pedro Gonnet's avatar
Pedro Gonnet committed
40

41
42
43
  /* The underlying runner. */
  struct engine *e;
};
Pedro Gonnet's avatar
Pedro Gonnet committed
44
45

/* Function prototypes. */
46
47
48
49
50
51
52
53
54
55
56
57
58
void runner_doghost(struct runner *r, struct cell *c);
void runner_dopair_density(struct runner *r, struct cell *ci, struct cell *cj);
void runner_doself_density(struct runner *r, struct cell *c);
void runner_dosub_density(struct runner *r, struct cell *ci, struct cell *cj,
                          int flags);
void runner_dosort(struct runner *r, struct cell *c, int flag, int clock);
void runner_dogsort(struct runner *r, struct cell *c, int flag, int clock);
void runner_dokick(struct runner *r, struct cell *c, int timer);
void runner_dokick1(struct runner *r, struct cell *c);
void runner_dokick2(struct runner *r, struct cell *c);
void *runner_main(void *data);

#endif /* SWIFT_RUNNER_H */