Skip to content

Commit

Permalink
Modify PMI_Get_clique_ranks() to return an array of integers rather
Browse files Browse the repository at this point in the history
    than a char * to satisfy PMI standard. Correct logic in 
    PMI_Get_clique_size() for when srun --overcommit option is used.
  • Loading branch information
Moe Jette committed Nov 12, 2008
1 parent 703c329 commit dd70a79
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 7 deletions.
6 changes: 5 additions & 1 deletion NEWS
Expand Up @@ -7,8 +7,12 @@ documents those changes that are of interest to users and admins.
-- Rebuild slurmctld's job select_jobinfo->node_bitmap on restart/reconfigure -- Rebuild slurmctld's job select_jobinfo->node_bitmap on restart/reconfigure
of the daemon rather than restoring the bitmap since the nodes in a system of the daemon rather than restoring the bitmap since the nodes in a system
can change (be added or removed). can change (be added or removed).
-- Add configuration option "--with-cpusetdir=PATH" for non-standard locations. -- Add configuration option "--with-cpusetdir=PATH" for non-standard
locations.
-- Get new multi-core data structures working on BlueGene systems. -- Get new multi-core data structures working on BlueGene systems.
-- Modify PMI_Get_clique_ranks() to return an array of integers rather
than a char * to satisfy PMI standard. Correct logic in
PMI_Get_clique_size() for when srun --overcommit option is used.


* Changes in SLURM 1.4.0-pre4 * Changes in SLURM 1.4.0-pre4
============================= =============================
Expand Down
11 changes: 10 additions & 1 deletion RELEASE_NOTES
@@ -1,5 +1,5 @@
RELEASE NOTES FOR SLURM VERSION 1.4 RELEASE NOTES FOR SLURM VERSION 1.4
6 October 2008 12 November 2008 (after SLURM 1.4.0-pre4 released)




IMPORTANT NOTE: IMPORTANT NOTE:
Expand All @@ -22,6 +22,11 @@ HIGHLIGHTS
order to effectively preempt or gang schedule jobs. order to effectively preempt or gang schedule jobs.
* A new configuration parameter, PrologSlurmctld, can be used to support the * A new configuration parameter, PrologSlurmctld, can be used to support the
booting of different operating systems for each job. booting of different operating systems for each job.
* Preemption of jobs from lower priority partitions in order to execute jobs
in higher priority partitions is now supported. The jobs from the lower
priority partition will resume once preempting job completes.
NOTE: Supported only in SelectType=select/cons_res only as of 12 November
2008.


CONFIGURATION FILE CHANGES (see "man slurm.conf" for details) CONFIGURATION FILE CHANGES (see "man slurm.conf" for details)
* DefMemPerTask has been removed. Use DefMemPerCPU or DefMemPerNode instead. * DefMemPerTask has been removed. Use DefMemPerCPU or DefMemPerNode instead.
Expand All @@ -44,3 +49,7 @@ COMMAND CHANGES (see man pages for details)
* --task-mem and --job-mem options have been removed from sall,c sbatch and * --task-mem and --job-mem options have been removed from sall,c sbatch and
srun. Use --mem-per-cpu or --mem instead. srun. Use --mem-per-cpu or --mem instead.
* --ctrl-comm-ifhn-addr option has been removed from the srun comma.d * --ctrl-comm-ifhn-addr option has been removed from the srun comma.d

OTHER CHANGES
* The libpmi function PMI_Get_clique_ranks() has been changed to return an
array of integers rather than a string to satisfy PMI standard.
2 changes: 1 addition & 1 deletion slurm/pmi.h
Expand Up @@ -389,7 +389,7 @@ communicate through IPC mechanisms (e.g., shared memory) and other network
mechanisms. mechanisms.
@*/ @*/
int PMI_Get_clique_ranks( char ranks[], int length); int PMI_Get_clique_ranks( int ranks[], int length);


/*@ /*@
PMI_Abort - abort the process group associated with this process PMI_Abort - abort the process group associated with this process
Expand Down
25 changes: 21 additions & 4 deletions src/api/pmi.c
Expand Up @@ -711,9 +711,14 @@ int PMI_Get_clique_size( int *size )
if (size == NULL) if (size == NULL)
return PMI_ERR_INVALID_ARG; return PMI_ERR_INVALID_ARG;


env = getenv("SLURM_CPUS_ON_NODE"); env = getenv("SLURM_GTIDS");
if (env) { if (env) {
*size = atoi(env); int i, tids=1;
for (i=0; env[i]; i++) {
if (env[i] == ',')
tids++;
}
*size = tids;
return PMI_SUCCESS; return PMI_SUCCESS;
} }
return PMI_FAIL; return PMI_FAIL;
Expand Down Expand Up @@ -742,7 +747,7 @@ communicate through IPC mechanisms (e.g., shared memory) and other network
mechanisms. mechanisms.
@*/ @*/
int PMI_Get_clique_ranks( char ranks[], int length ) int PMI_Get_clique_ranks( int ranks[], int length )
{ {
char *env; char *env;


Expand All @@ -754,7 +759,19 @@ int PMI_Get_clique_ranks( char ranks[], int length )


env = getenv("SLURM_GTIDS"); env = getenv("SLURM_GTIDS");
if (env) { if (env) {
strcpy(ranks, env); int i = 0;
char *tid, *tids, *last;
tids = strdup(env);
tid = strtok_r(tids, ",", &last);
while (tid) {
if (i >= length) {
free(tids);
return PMI_ERR_INVALID_LENGTH;
}
ranks[i++] = atoi(tid);
tid = strtok_r(NULL, ",", &last);
}
free(tids);
return PMI_SUCCESS; return PMI_SUCCESS;
} }


Expand Down
19 changes: 19 additions & 0 deletions testsuite/expect/test7.2.prog.c
Expand Up @@ -50,6 +50,7 @@ main (int argc, char **argv)
{ {
int i, j, rc; int i, j, rc;
int nprocs, procid; int nprocs, procid;
int clique_size, *clique_ranks = NULL;
char *nprocs_ptr, *procid_ptr; char *nprocs_ptr, *procid_ptr;
int pmi_rank, pmi_size, kvs_name_len, key_len, val_len; int pmi_rank, pmi_size, kvs_name_len, key_len, val_len;
PMI_BOOL initialized; PMI_BOOL initialized;
Expand Down Expand Up @@ -120,6 +121,24 @@ main (int argc, char **argv)
exit(1); exit(1);
} }


if ((rc = PMI_Get_clique_size(&clique_size)) != PMI_SUCCESS) {
printf("FAILURE: PMI_Get_clique_size: %d, task %d\n",
rc, pmi_rank);
exit(1);
}
clique_ranks = malloc(sizeof(int) * clique_size);
if ((rc = PMI_Get_clique_ranks(clique_ranks, clique_size)) !=
PMI_SUCCESS) {
printf("FAILURE: PMI_Get_clique_ranks: %d, task %d\n",
rc, pmi_rank);
exit(1);
}
#if _DEBUG
for (i=0; i<clique_size; i++)
printf("PMI_Get_clique_ranks[%d]=%d\n", i, clique_ranks[i]);
#endif
free(clique_ranks);

if ((rc = PMI_KVS_Get_name_length_max(&kvs_name_len)) != PMI_SUCCESS) { if ((rc = PMI_KVS_Get_name_length_max(&kvs_name_len)) != PMI_SUCCESS) {
printf("FAILURE: PMI_KVS_Get_name_length_max: %d, task %d\n", printf("FAILURE: PMI_KVS_Get_name_length_max: %d, task %d\n",
rc, pmi_rank); rc, pmi_rank);
Expand Down

0 comments on commit dd70a79

Please sign in to comment.