Commit e55a4edd authored by Mladen Ivkovic's avatar Mladen Ivkovic

rt tasks are being activated and called now.

parent 9bf3718a
......@@ -1631,6 +1631,9 @@ int engine_estimate_nr_tasks(const struct engine *e) {
n1 += 1;
}
#endif
if (e->policy & engine_policy_rt) {
n1 += 14;
}
#ifdef WITH_MPI
......
......@@ -3548,4 +3548,7 @@ void engine_maketasks(struct engine *e) {
if (e->verbose)
message("took %.3f %s (including reweight).",
clocks_from_ticks(getticks() - tic), clocks_getunit());
scheduler_write_dependencies(sched, 1);
}
......@@ -261,6 +261,13 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
}
}
/* Activate RT injection */
else if (t_subtype == task_subtype_rt_inject) {
if (ci_active_hydro) {
scheduler_activate(s, t);
}
}
#ifdef SWIFT_DEBUG_CHECKS
else {
error("Invalid task type / sub-type encountered");
......@@ -463,6 +470,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
cell_activate_subcell_grav_tasks(t->ci, t->cj, s);
}
#ifdef SWIFT_DEBUG_CHECKS
else if (t_type == task_type_sub_pair &&
t_subtype == task_subtype_grav) {
......@@ -471,6 +479,24 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
#endif
}
/* RT injection tasks */
else if (t_subtype == task_subtype_rt_inject) {
/* We only want to activate the task if the cell is active and is
going to update some gas on the *local* node */
if ((ci_nodeID == nodeID && cj_nodeID == nodeID) &&
(ci_active_hydro || cj_active_hydro)) {
scheduler_activate(s, t);
} else if ((ci_nodeID == nodeID && cj_nodeID != nodeID) &&
(cj_active_hydro)) {
scheduler_activate(s, t);
} else if ((ci_nodeID != nodeID && cj_nodeID == nodeID) &&
(ci_active_hydro)) {
scheduler_activate(s, t);
}
}
/* Only interested in density tasks as of here. */
if (t_subtype == task_subtype_density) {
......@@ -858,6 +884,11 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
scheduler_activate_send(s, ci->mpi.send, task_subtype_tend_gpart,
cj_nodeID);
}
#endif
} /* Only interested in RT tasks as of here. */
else if (t_subtype == task_subtype_rt_inject) {
#ifdef WITH_MPI
error("RT doesn't work with MPI yet.");
#endif
}
}
......
/* TODO: dox, license, etc */
#include "runner_doiact_rt.h"
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
* 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
* 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* 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.
*
* 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.
*
* 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/>.
*
******************************************************************************/
/* TODO: TEMPORARY */
#include <stdio.h>
/* Before including this file, define FUNCTION, which is the
name of the interaction function. This creates the interaction functions
runner_dopair_FUNCTION, runner_dopair_FUNCTION_naive, runner_doself_FUNCTION,
and runner_dosub_FUNCTION calling the pairwise interaction function
runner_iact_FUNCTION. */
#include "runner_doiact_rt.h"
/**
* @brief TODO
*
* @param r runner task
* @param c cell
* @param timer 1 if the time is to be recorded.
*/
void DOSELF1_RT(struct runner *r, struct cell *c, int timer){
TIMER_TIC;
printf("called DOSELF1_RT for cell %p\n", c);
message("message from DOSELF1_RT");
if (timer) TIMER_TOC(TIMER_DOSELF_RT);
}
void DOPAIR1_RT(struct runner *r, struct cell *ci, struct cell *cj, int timer){
/**
* @brief TODO
*
* @param r runner task
* @param c cell
* @param timer 1 if the time is to be recorded.
*/
void DOPAIR1_SYM_RT(struct runner *r, struct cell *ci, struct cell *cj, int timer){
TIMER_TIC;
printf("called DOPAIR1_RT for cells %p, %p\n", ci, cj);
message("message from DOPAIR1_RT");
if (timer) TIMER_TOC(TIMER_DOPAIR_RT);
}
/**
* @brief Determine which version of DOSELF1_RT needs to be called depending
* on the optimisation level.
*
* @param r #runner
* @param c #cell c
* @param timer 1 if the time is to be recorded.
*/
void DOSELF1_BRANCH_RT(struct runner *r, struct cell *c, int timer) {
DOSELF1_RT(r, c, timer);
}
/**
* @brief Determine which version of DOPAIR1_RT needs to be called depending
* on the optimisation level.
*
* @param r #runner
* @param c #cell c
* @param timer 1 if the time is to be recorded.
*/
void DOPAIR1_BRANCH_RT(struct runner *r, struct cell *ci, struct cell *cj, int timer) {
DOPAIR1_RT(r, ci, cj, timer);
DOPAIR1_SYM_RT(r, ci, cj, timer);
}
/**
* @brief Compute grouped sub-cell interactions for self tasks
*
* @param r The #runner.
* @param ci The first #cell.
* @param gettimer Do we have a timer ?
*/
void DOSUB_SELF1_RT(struct runner *r, struct cell *c, int timer) {
DOSELF1_RT(r, c, timer);
}
/**
* @brief Compute grouped sub-cell interactions for pair tasks
*
* @param r The #runner.
* @param ci The first #cell.
* @param gettimer Do we have a timer ?
*/
void DOSUB_PAIR1_RT(struct runner *r, struct cell *ci, struct cell *cj, int timer) {
DOPAIR1_RT(r, ci, cj, timer);
DOPAIR1_SYM_RT(r, ci, cj, timer);
}
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
* 2018 Loic Hausammann (loic.hausammann@epfl.ch)
* 2020 Mladen Ivkovic (mladen.ivkovic@hotmail.com)
*
* This program is free software: you can redistribute it and/or modify
......@@ -28,15 +29,20 @@
#define _DOSELF1_RT(f) PASTE(runner_doself_rt, f)
#define DOSELF1_RT _DOSELF1_RT(FUNCTION)
#define _DO_SYM_PAIR1_RT(f) PASTE(runner_do_sym_pair_rt, f)
#define DO_SYM_PAIR1_RT _DO_SYM_PAIR1_RT(FUNCTION)
#define _DOPAIR1_SYM_RT(f) PASTE(runner_dopair_rt, f)
#define DOPAIR1_SYM_RT _DOPAIR1_SYM_RT(FUNCTION)
#define _DO_NONSYM_PAIR1_RT_NAIVE(f) \
PASTE(runner_do_nonsym_pair_rt_naive, f)
#define DO_NONSYM_PAIR1_RT_NAIVE _DO_NONSYM_PAIR1_RT_NAIVE(FUNCTION)
#define _DOPAIR1_NONSYM_RT(f) PASTE(runner_dopair_nonsym_rt, f)
#define DOPAIR1_NONSYM_RT _DOPAIR1_NONSYM_RT(FUNCTION)
#define _DOPAIR1_RT_NAIVE(f) PASTE(runner_dopair_rt_naive, f)
#define DOPAIR1_RT_NAIVE _DOPAIR1_RT_NAIVE(FUNCTION)
#define _DOPAIR1_SYM_NAIVE_RT(f) PASTE(runner_dopair_naive_rt, f)
#define DOPAIR1_SYM_NAIVE_RT _DOPAIR1_SYM_NAIVE_RT(FUNCTION)
#define _DOPAIR1_NONSYM_NAIVE_RT(f) PASTE(runner_dopair_nonsym_naive_rt, f)
#define DOPAIR1_NONSYM_NAIVE_RT _DOPAIR1_NONSYM_NAIVE_RT(FUNCTION)
#define _DOPAIR1_RT(f) PASTE(runner_dopair_rt, f)
#define DOPAIR1_RT_DOPAIR1_RT(FUNCTION)
#define _DOSELF1_BRANCH_RT(f) PASTE(runner_doself_branch_rt, f)
#define DOSELF1_BRANCH_RT _DOSELF1_BRANCH_RT(FUNCTION)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment