refactor functions in unifyfs-rm.c
System information
| Type | Version/Name |
|---|---|
| Operating System | |
| OS Version | |
| Architecture | |
| UnifyFS Version |
Describe the problem you're observing
jsrun_stage(), mpirun_stage(), and srun_stage() all share the same basic code with different data values. Why not refactor them so that they pass an arg string to a new generic_stage() function that tokenizes an arg string and assigns it to args[], and does the execvp()?
Psudocode:
srun_stage() { sprintf(cmd, "srun -N %zu --ntasks-per-node 1", resource->n_nodes) generic_stage(cmd); }
mpirun_stage() { sprintf(cmd, "mpirun -np %zu --map-by ppr:1:node", resource->n_nodes); generic_stage(cmd); } ...
Describe how to reproduce the problem
Include any warning or errors or releveant debugging data
Tony put the above suggestion in PR 511. I agree, and the point is well taken, but I think keeping it as a separate branch is a better way of keeping things split up.
Summary: there are a bunch of parallel functions in unifyfs-rm.c that do much the same thing, just slightly differently. There will be half again as many functions now once 511 goes in. There's a lot of redundant code, so a re-think of how these functions are put together is probably a good plan.
This is being addressed in PR 614.