diff --git a/NEWS b/NEWS index 2edc94d527fae910ac8f65504f395ef33b84271a..f6f21dbe72dbf8c4d112cea4895e0fb20a1005d4 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ documents those changes that are of interest to users and admins. -- Added slurm-sjobexit RPM for SLURM job exit code management tools. -- Added ability to use sstat/sacct against the batch step. -- Added OnlyDefaults option to sacctmgr list associations. + -- Modified the fairshare priority formula to F = 2**(-Ue/S) * Changes in SLURM 2.2.0.pre12 ============================== diff --git a/doc/html/priority_multifactor.shtml b/doc/html/priority_multifactor.shtml index 60ddf3ebab9e844ac4276a432302efc1c862913a..6093ab515bb4305d5c3915fbac0cd84b734b556d 100644 --- a/doc/html/priority_multifactor.shtml +++ b/doc/html/priority_multifactor.shtml @@ -265,7 +265,7 @@ Where: <P> The simplified formula for calculating the fair-share factor for usage that spans multiple time periods and subject to a half-life decay is:</P> <PRE> - F = (S - U + 1) / 2 + F = 2**(-U/S) </PRE> Where: @@ -303,7 +303,7 @@ Where: <P> The actual formula used is a refinement of the formula presented above:</P> <PRE> - F = (S - U<sub>E</sub> + 1) / 2 + F = 2**(-U<sub>E</sub>/S) </PRE> <P> The difference is that the usage term is effective usage, which is defined as:</P> @@ -396,17 +396,17 @@ Account A's effective usage is therefore equal to .45. Account D's effective us <P> Using the SLURM fair-share formula,</P> <PRE> - F = (S - U<sub>E</sub> + 1) / 2 + F = 2**(-U<sub>E</sub>/S) </PRE> <P> the fair-share factor for each user is:</P> <UL> -<LI> User 1 fair-share factor: (.3 - .3875 + 1) / 2 = 0.45625 -<LI> User 2 fair-share factor: (.05 - .275 + 1) / 2 = 0.3875 -<LI> User 3 fair-share factor: (.05 - .15 + 1) / 2 = 0.45 -<LI> User 4 fair-share factor: (.25 - .25 + 1) / 2 = 0.5 -<LI> User 5 fair-share factor: (.35 - .1458 + 1) / 2 = 0.6021 +<LI> User 1 fair-share factor: 2**(-.3875 / .3) = 0.408479 +<LI> User 2 fair-share factor: 2**(-.275 / .05) = 0.022097 +<LI> User 3 fair-share factor: 2**(-.15 / .05) = 0.125000 +<LI> User 4 fair-share factor: 2**(-.25 / .25) = 0.500000 +<LI> User 5 fair-share factor: 2**(-.1458 / .35) = 0.749154 </UL> <P> From this example, once can see that users 1,2, and 3 are over-serviced while user 5 is under-serviced. Even though user 3 has yet to submit a job, his/her fair-share factor is negatively influenced by the jobs users 1 and 2 have run.</P> @@ -545,7 +545,7 @@ PriorityWeightQOS=0 # don't use the qos factor </PRE> <!--------------------------------------------------------------------------> -<p style="text-align:center;">Last modified 14 January 2010</p> +<p style="text-align:center;">Last modified 2 November 2010</p> <!--#include virtual="footer.txt"--> diff --git a/src/plugins/priority/multifactor/priority_multifactor.c b/src/plugins/priority/multifactor/priority_multifactor.c index 5fb8af66c5611e24600a311997752f7d0688e170..1d81ad28bb8f7567b124ecdcca1985d39759d4cf 100644 --- a/src/plugins/priority/multifactor/priority_multifactor.c +++ b/src/plugins/priority/multifactor/priority_multifactor.c @@ -402,21 +402,21 @@ static double _get_fairshare_priority( struct job_record *job_ptr) priority_p_set_assoc_usage(assoc); // Priority is 0 -> 1 - priority_fs = - (assoc->usage->shares_norm - - (double)assoc->usage->usage_efctv + 1.0) / 2.0; + if (assoc->usage->shares_norm > 0.0) + priority_fs = pow(2.0, -(assoc->usage->usage_efctv / + assoc->usage->shares_norm)); + else + priority_fs = 0.0; + if(priority_debug) - info("Fairshare priority for user %s in acct %s" - "((%f - %Lf) + 1) / 2 = %f", - assoc->user, assoc->acct, assoc->usage->shares_norm, - assoc->usage->usage_efctv, priority_fs); + info("Fairshare priority of job %u for user %s in acct %s" + " is 2**(-%Lf/%f) = %f", + job_ptr->job_id, assoc->user, assoc->acct, + assoc->usage->usage_efctv, assoc->usage->shares_norm, + priority_fs); assoc_mgr_unlock(&locks); - if(priority_debug) - info("job %u has a fairshare priority of %f", - job_ptr->job_id, priority_fs); - return priority_fs; } diff --git a/src/sshare/Makefile.am b/src/sshare/Makefile.am index e935d03f6365374534daf6fddde6892a999efa64..5ff6e8cce7665d7d84c4387434b3a84adbfceeac 100644 --- a/src/sshare/Makefile.am +++ b/src/sshare/Makefile.am @@ -8,7 +8,7 @@ INCLUDES = -I$(top_srcdir) bin_PROGRAMS = sshare sshare_LDADD = \ - $(top_builddir)/src/api/libslurm.o -ldl\ + $(top_builddir)/src/api/libslurm.o -ldl -lm \ $(READLINE_LIBS) sshare_SOURCES = \ diff --git a/src/sshare/Makefile.in b/src/sshare/Makefile.in index 0daab27b1ad4bcab4ae2fb7244d1443391ab779e..f35bce20e6c0a44a06c417fa69e866c3df19144d 100644 --- a/src/sshare/Makefile.in +++ b/src/sshare/Makefile.in @@ -305,7 +305,7 @@ AUTOMAKE_OPTIONS = foreign CLEANFILES = core.* INCLUDES = -I$(top_srcdir) sshare_LDADD = \ - $(top_builddir)/src/api/libslurm.o -ldl\ + $(top_builddir)/src/api/libslurm.o -ldl -lm \ $(READLINE_LIBS) sshare_SOURCES = \ diff --git a/src/sshare/process.c b/src/sshare/process.c index 54b79ee9e1b35b25081af11e9e561f2e642e2a16..0d04e728d0a842a2423bb217cc241add722cad35 100644 --- a/src/sshare/process.c +++ b/src/sshare/process.c @@ -37,6 +37,7 @@ \*****************************************************************************/ #include "src/sshare/sshare.h" +#include <math.h> extern int long_flag; @@ -209,9 +210,9 @@ extern int process(shares_response_msg_t *resp) break; case PRINT_FSFACTOR: field->print_routine(field, - (share->shares_norm - - (double)share->usage_efctv - + 1.0) / 2.0, + pow(2.0, + -(share->usage_efctv / + share->shares_norm)), (curr_inx == field_count)); break; case PRINT_ID: diff --git a/testsuite/expect/test24.1 b/testsuite/expect/test24.1 index 4a20ff5b575ee57d1891a94c8a6abc9962c346bb..347cc80a014563d2e2494abd3c933b6980f76300 100755 --- a/testsuite/expect/test24.1 +++ b/testsuite/expect/test24.1 @@ -48,11 +48,11 @@ file delete $test_prog send_user "build_dir is $build_dir\n" if {[test_aix]} { - send_user "$bin_cc ${test_prog}.c -ldl -lntbl -fno-gcse -fno-strict-aliasing -Wl,-brtl -Wl,-bgcbypass:1000 -Wl,-bexpfull -Wl,-bmaxdata:0x70000000 -Wl,-brtl -g -lpthreads -o ${test_prog} -I${build_dir} -I${src_dir} ${build_dir}/src/api/libslurm.o ${build_dir}/src/slurmctld/locks.o ${build_dir}/src/sshare/process.o\n" - exec $bin_cc ${test_prog}.c -ldl -lntbl -fno-gcse -fno-strict-aliasing -Wl,-brtl -Wl,-bgcbypass:1000 -Wl,-bexpfull -Wl,-bmaxdata:0x70000000 -Wl,-brtl -g -lpthreads -o ${test_prog} -I${build_dir} -I${src_dir} ${build_dir}/src/api/libslurm.o ${build_dir}/src/slurmctld/locks.o ${build_dir}/src/sshare/process.o + send_user "$bin_cc ${test_prog}.c -ldl -lm -lntbl -fno-gcse -fno-strict-aliasing -Wl,-brtl -Wl,-bgcbypass:1000 -Wl,-bexpfull -Wl,-bmaxdata:0x70000000 -Wl,-brtl -g -lpthreads -o ${test_prog} -I${build_dir} -I${src_dir} ${build_dir}/src/api/libslurm.o ${build_dir}/src/slurmctld/locks.o ${build_dir}/src/sshare/process.o\n" + exec $bin_cc ${test_prog}.c -ldl -lm -lntbl -fno-gcse -fno-strict-aliasing -Wl,-brtl -Wl,-bgcbypass:1000 -Wl,-bexpfull -Wl,-bmaxdata:0x70000000 -Wl,-brtl -g -lpthreads -o ${test_prog} -I${build_dir} -I${src_dir} ${build_dir}/src/api/libslurm.o ${build_dir}/src/slurmctld/locks.o ${build_dir}/src/sshare/process.o } else { - send_user "$bin_cc ${test_prog}.c -g -pthread -o ${test_prog} -I${build_dir} -I${src_dir} ${build_dir}/src/api/libslurm.o ${build_dir}/src/slurmctld/locks.o ${build_dir}/src/sshare/process.o -ldl -export-dynamic \n" - exec $bin_cc ${test_prog}.c -g -pthread -o ${test_prog} -I${build_dir} -I${src_dir} ${build_dir}/src/api/libslurm.o ${build_dir}/src/slurmctld/locks.o ${build_dir}/src/sshare/process.o -ldl -export-dynamic + send_user "$bin_cc ${test_prog}.c -g -pthread -o ${test_prog} -I${build_dir} -I${src_dir} ${build_dir}/src/api/libslurm.o ${build_dir}/src/slurmctld/locks.o ${build_dir}/src/sshare/process.o -ldl -lm -export-dynamic \n" + exec $bin_cc ${test_prog}.c -g -pthread -o ${test_prog} -I${build_dir} -I${src_dir} ${build_dir}/src/api/libslurm.o ${build_dir}/src/slurmctld/locks.o ${build_dir}/src/sshare/process.o -ldl -lm -export-dynamic } exec $bin_chmod 700 $test_prog @@ -67,55 +67,55 @@ expect { send_user "This error is expected. No worries.\n" exp_continue } - "AccountA||40|0.400000|45|0.450000|0.450000|" { + "AccountA||40|0.400000|45|0.450000|0.450000|0.458502|" { incr matches exp_continue } - "AccountB||30|0.300000|20|0.200000|0.387500|" { + "AccountB||30|0.300000|20|0.200000|0.387500|0.408479|" { incr matches exp_continue } - "AccountB|User1|1|0.300000|20|0.200000|0.387500|" { + "AccountB|User1|1|0.300000|20|0.200000|0.387500|0.408479|" { incr matches exp_continue } - "AccountC||10|0.100000|25|0.250000|0.300000|" { + "AccountC||10|0.100000|25|0.250000|0.300000|0.125000|" { incr matches exp_continue } - "AccountC|User2|1|0.050000|25|0.250000|0.275000|" { + "AccountC|User2|1|0.050000|25|0.250000|0.275000|0.022097|" { incr matches exp_continue } - "AccountC|User3|1|0.050000|0|0.000000|0.150000|" { + "AccountC|User3|1|0.050000|0|0.000000|0.150000|0.125000|" { incr matches exp_continue } - "AccountD||30|0.300000|25|0.250000|0.250000|" { + "AccountD||60|0.600000|25|0.250000|0.250000|0.749154|" { incr matches exp_continue } - "AccountE||25|0.125000|25|0.250000|0.250000|" { + "AccountE||25|0.250000|25|0.250000|0.250000|0.500000|" { incr matches exp_continue } - "AccountE|User4|1|0.125000|25|0.250000|0.250000|" { + "AccountE|User4|1|0.250000|25|0.250000|0.250000|0.500000|" { incr matches exp_continue } - "AccountF||35|0.175000|0|0.000000|0.145833|" { + "AccountF||35|0.350000|0|0.000000|0.145833|0.749154|" { incr matches exp_continue } - "AccountF|User5|1|0.175000|0|0.000000|0.145833|" { + "AccountF|User5|1|0.350000|0|0.000000|0.145833|0.749154|" { incr matches exp_continue } - "AccountG||30|0.300000|30|0.300000|0.300000|" { + "AccountG||0|0.000000|30|0.300000|0.300000|0.000000|" { incr matches exp_continue } - "AccountG|User6|1|0.300000|30|0.300000|0.300000|" { + "AccountG|User6|0|" { incr matches exp_continue } diff --git a/testsuite/expect/test24.1.prog.c b/testsuite/expect/test24.1.prog.c index 4b8402559bb089a65d313231be49aec9a38ae0c8..e77ea9f02c826d7313dcbce1235dd4a680560230 100644 --- a/testsuite/expect/test24.1.prog.c +++ b/testsuite/expect/test24.1.prog.c @@ -191,34 +191,10 @@ int _setup_assoc_list() /* assoc->lft = 14; */ /* assoc->rgt = 23; */ assoc->parent_id = 1; - assoc->shares_raw = 30; + assoc->shares_raw = 60; assoc->acct = xstrdup("AccountD"); list_push(update.objects, assoc); - /* sub of AccountD id 3 */ - assoc = xmalloc(sizeof(slurmdb_association_rec_t)); - assoc->usage = create_assoc_mgr_association_usage(); - assoc->id = 32; - /* assoc->lft = 15; */ - /* assoc->rgt = 18; */ - assoc->parent_id = 3; - assoc->shares_raw = 35; - assoc->acct = xstrdup("AccountF"); - list_push(update.objects, assoc); - - /* sub of AccountF id 32 */ - assoc = xmalloc(sizeof(slurmdb_association_rec_t)); - assoc->usage = create_assoc_mgr_association_usage(); - assoc->id = 321; - /* assoc->lft = 16; */ - /* assoc->rgt = 17; */ - assoc->parent_id = 32; - assoc->shares_raw = 1; - assoc->usage->usage_raw = 0; - assoc->acct = xstrdup("AccountF"); - assoc->user = xstrdup("User5"); - list_push(update.objects, assoc); - /* sub of AccountD id 3 */ assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc->usage = create_assoc_mgr_association_usage(); @@ -243,6 +219,30 @@ int _setup_assoc_list() assoc->user = xstrdup("User4"); list_push(update.objects, assoc); + /* sub of AccountD id 3 */ + assoc = xmalloc(sizeof(slurmdb_association_rec_t)); + assoc->usage = create_assoc_mgr_association_usage(); + assoc->id = 32; + /* assoc->lft = 15; */ + /* assoc->rgt = 18; */ + assoc->parent_id = 3; + assoc->shares_raw = 35; + assoc->acct = xstrdup("AccountF"); + list_push(update.objects, assoc); + + /* sub of AccountF id 32 */ + assoc = xmalloc(sizeof(slurmdb_association_rec_t)); + assoc->usage = create_assoc_mgr_association_usage(); + assoc->id = 321; + /* assoc->lft = 16; */ + /* assoc->rgt = 17; */ + assoc->parent_id = 32; + assoc->shares_raw = 1; + assoc->usage->usage_raw = 0; + assoc->acct = xstrdup("AccountF"); + assoc->user = xstrdup("User5"); + list_push(update.objects, assoc); + /* sub of root id 1 */ assoc = xmalloc(sizeof(slurmdb_association_rec_t)); assoc->usage = create_assoc_mgr_association_usage(); @@ -250,7 +250,7 @@ int _setup_assoc_list() /* assoc->lft = 24; */ /* assoc->rgt = 27; */ assoc->parent_id = 1; - assoc->shares_raw = 30; + assoc->shares_raw = 0; assoc->acct = xstrdup("AccountG"); list_push(update.objects, assoc); @@ -261,7 +261,7 @@ int _setup_assoc_list() /* assoc->lft = 25; */ /* assoc->rgt = 26; */ assoc->parent_id = 4; - assoc->shares_raw = 1; + assoc->shares_raw = 0; assoc->usage->usage_raw = 30; assoc->acct = xstrdup("AccountG"); assoc->user = xstrdup("User6");