Engine policies for gravity and improved task mask construction
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
Activity
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); 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
Added 1 commit:
- fe44d13b - Correct documentation of mask and submask arguments
mentioned in commit 2b8930c4