Skip to content
Snippets Groups Projects

Engine policies for gravity and improved task mask construction

Merged Matthieu Schaller requested to merge more_policies into master

This is a straightforward change to engine_step() and engine_init_particles() that should allow other users to add or remove tasks without having to comment-out portions of the code.

The right list of policies simply has to be passed to the engine when constructed. I have added three policies (hydro, external gravity and self gravity) to be future proof.

I have also resurrected the two functions that print the content of a mask. These had disappeared following a merge. Finally, some more robust bit-mask checking tests are done when testing policies.

That should allow @jregan and @tt to add their external gravity tasks to the mask on line 1901 (in engine_step()) of engine.c without having to comment-out other parts of the code.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
342 340 tic = getticks();
343 341 if (myrank == 0) message("nr_nodes is %i.", nr_nodes);
344 342 engine_init(&e, &s, dt_max, nr_threads, nr_queues, nr_nodes, myrank,
345 ENGINE_POLICY | engine_policy_steal, 0, time_end, dt_min, dt_max);
343 ENGINE_POLICY | engine_policy_steal | engine_policy_hydro, 0,
344 time_end, dt_min, dt_max);
  • 342 340 tic = getticks();
    343 341 if (myrank == 0) message("nr_nodes is %i.", nr_nodes);
    344 342 engine_init(&e, &s, dt_max, nr_threads, nr_queues, nr_nodes, myrank,
    345 ENGINE_POLICY | engine_policy_steal, 0, time_end, dt_min, dt_max);
    343 ENGINE_POLICY | engine_policy_steal | engine_policy_hydro, 0,
    344 time_end, dt_min, dt_max);
    • So far, I'd leave it here.

      I think we need to agree on what is the best way to switch between different ways of operating the code (i.e. hydro only, gravity only, hydro + gravity, etc.) I don't have a clear picture in mind as of now but if you have something to suggest I'd be very interested.

  • 342 340 tic = getticks();
    343 341 if (myrank == 0) message("nr_nodes is %i.", nr_nodes);
    344 342 engine_init(&e, &s, dt_max, nr_threads, nr_queues, nr_nodes, myrank,
    345 ENGINE_POLICY | engine_policy_steal, 0, time_end, dt_min, dt_max);
    343 ENGINE_POLICY | engine_policy_steal | engine_policy_hydro, 0,
    344 time_end, dt_min, dt_max);
    • OK, I think I was getting ahead of the game, and imagined that having a policy also meant it was honoured in some sense. Since John and Tom have been running without hydro they clearly have identified the sections of code that need wrapping by this flag, so isn't it that simple?

  • 342 340 tic = getticks();
    343 341 if (myrank == 0) message("nr_nodes is %i.", nr_nodes);
    344 342 engine_init(&e, &s, dt_max, nr_threads, nr_queues, nr_nodes, myrank,
    345 ENGINE_POLICY | engine_policy_steal, 0, time_end, dt_min, dt_max);
    343 ENGINE_POLICY | engine_policy_steal | engine_policy_hydro, 0,
    344 time_end, dt_min, dt_max);
    • So far they are not honoured in any way but the code in engine_step() will use these policies. That's where John and Tom will (should) add their contribution. Adding the policies here allows to be future-proof. Switching between policies should be left for later.

      Edited by Matthieu Schaller
  • Peter W. Draper Added 1 commit:

    Added 1 commit:

    • fe44d13b - Correct documentation of mask and submask arguments
  • Peter W. Draper mentioned in commit 2b8930c4

    mentioned in commit 2b8930c4

  • Peter W. Draper Status changed to merged

    Status changed to merged

  • OK, looks good to me and nicely clarifies how policies and task masks are constructed, so accepted.

  • Please register or sign in to reply
    Loading