~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/api/pmi.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 *  Copyright (C) 2005-2006 The Regents of the University of California.
50
50
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
51
51
 *  Written by Morris Jette <jette1@llnl.gov>
52
 
 *  LLNL-CODE-402394.
 
52
 *  CODE-OCEC-09-009. All rights reserved.
53
53
 *
54
54
 *  This file is part of SLURM, a resource management program.
55
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
55
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
56
 *  Please also read the included file: DISCLAIMER.
56
57
 *
57
58
 *  SLURM is free software; you can redistribute it and/or modify it under
58
59
 *  the terms of the GNU General Public License as published by the Free
184
185
        if (pmi_init)
185
186
                goto replay;
186
187
 
187
 
        env = getenv("SLURM_JOBID");
 
188
        env = getenv("SLURM_JOB_ID");
188
189
        if (env)
189
190
                pmi_jobid = atoi(env);
190
191
        else
445
446
        if (appnum == NULL)
446
447
                return PMI_ERR_INVALID_ARG;
447
448
 
448
 
        env = getenv("SLURM_JOBID");
 
449
        env = getenv("SLURM_JOB_ID");
449
450
        if (env) {
450
451
                *appnum = atoi(env);
451
452
                return PMI_SUCCESS;
711
712
        if (size == NULL)
712
713
                return PMI_ERR_INVALID_ARG;
713
714
 
714
 
        env = getenv("SLURM_CPUS_ON_NODE");
 
715
        env = getenv("SLURM_GTIDS");
715
716
        if (env) {
716
 
                *size = atoi(env);
 
717
                int i, tids=1;
 
718
                for (i=0; env[i]; i++) {
 
719
                        if (env[i] == ',')
 
720
                                tids++;
 
721
                }
 
722
                *size = tids;
717
723
                return PMI_SUCCESS;
718
724
        }
719
725
        return PMI_FAIL;
742
748
mechanisms.
743
749
 
744
750
@*/
745
 
int PMI_Get_clique_ranks( char ranks[], int length )
 
751
int PMI_Get_clique_ranks( int ranks[], int length )
746
752
{
747
753
        char *env;
748
754
 
754
760
 
755
761
        env = getenv("SLURM_GTIDS");
756
762
        if (env) {
757
 
                strcpy(ranks, env);
 
763
                int i = 0;
 
764
                char *tid, *tids, *last = NULL;
 
765
                tids = strdup(env);
 
766
                tid = strtok_r(tids, ",", &last);
 
767
                while (tid) {
 
768
                        if (i >= length) {
 
769
                                free(tids);
 
770
                                return PMI_ERR_INVALID_LENGTH;
 
771
                        }
 
772
                        ranks[i++] = atoi(tid);
 
773
                        tid = strtok_r(NULL, ",", &last);
 
774
                }
 
775
                free(tids);
758
776
                return PMI_SUCCESS;
759
777
        }
760
778
 
1123
1141
                        rc = PMI_FAIL;  /* malloc error */
1124
1142
                else {
1125
1143
                        rc = PMI_SUCCESS;
1126
 
                        strncpy(kvs_recs[i].kvs_values[j], value, PMI_MAX_VAL_LEN);
1127
 
                        strncpy(kvs_recs[i].kvs_keys[j],   key,   PMI_MAX_KEY_LEN);
 
1144
                        strncpy(kvs_recs[i].kvs_values[j], value, 
 
1145
                                PMI_MAX_VAL_LEN);
 
1146
                        strncpy(kvs_recs[i].kvs_keys[j], key, PMI_MAX_KEY_LEN);
1128
1147
                }
1129
1148
                goto fini;
1130
1149
        }
1289
1308
                if (strncmp(kvs_recs[i].kvs_name, kvsname, PMI_MAX_KVSNAME_LEN))
1290
1309
                        continue;
1291
1310
                for (j=0; j<kvs_recs[i].kvs_cnt; j++) {
1292
 
                        if (strncmp(kvs_recs[i].kvs_keys[j], key, PMI_MAX_KEY_LEN))
 
1311
                        if (strncmp(kvs_recs[i].kvs_keys[j], key,
 
1312
                                    PMI_MAX_KEY_LEN))
1293
1313
                                continue;
1294
1314
                        if (strlen(kvs_recs[i].kvs_values[j]) > (length-1))
1295
1315
                                rc = PMI_ERR_INVALID_LENGTH;
1296
1316
                        else {
1297
1317
                                strncpy(value, kvs_recs[i].kvs_values[j], 
1298
 
                                        PMI_MAX_VAL_LEN);
 
1318
                                        length);
1299
1319
                                rc = PMI_SUCCESS;
1300
1320
                        }
1301
1321
                        goto fini;
1372
1392
                        rc = PMI_ERR_INVALID_VAL_LENGTH;
1373
1393
                } else {
1374
1394
                        strncpy(key, kvs_recs[i].kvs_keys[kvs_recs[i].kvs_inx], 
1375
 
                                PMI_MAX_KEY_LEN);
1376
 
                        strncpy(val, kvs_recs[i].kvs_values[kvs_recs[i].kvs_inx],
1377
 
                                PMI_MAX_VAL_LEN);
 
1395
                                key_len);
 
1396
                        strncpy(val,
 
1397
                                kvs_recs[i].kvs_values[kvs_recs[i].kvs_inx],
 
1398
                                val_len);
1378
1399
                        rc = PMI_SUCCESS;
1379
1400
                }
1380
1401
                goto fini;
1449
1470
                        rc = PMI_ERR_INVALID_VAL_LENGTH;
1450
1471
                } else {
1451
1472
                        strncpy(key, kvs_recs[i].kvs_keys[kvs_recs[i].kvs_inx],
1452
 
                                PMI_MAX_KEY_LEN);
1453
 
                        strncpy(val, kvs_recs[i].kvs_values[kvs_recs[i].kvs_inx],
1454
 
                                PMI_MAX_VAL_LEN);
 
1473
                                key_len);
 
1474
                        strncpy(val, 
 
1475
                                kvs_recs[i].kvs_values[kvs_recs[i].kvs_inx],
 
1476
                                val_len);
1455
1477
                        rc = PMI_SUCCESS;
1456
1478
                }
1457
1479
                goto fini;
1551
1573
argument as long as the options are contiguous in the args array.
1552
1574
 
1553
1575
@*/
1554
 
int PMI_Parse_option(int num_args, char *args[], int *num_parsed, PMI_keyval_t **keyvalp, 
 
1576
int PMI_Parse_option(int num_args, char *args[], int *num_parsed,
 
1577
                     PMI_keyval_t **keyvalp, 
1555
1578
                int *size)
1556
1579
{
1557
1580
        int i, n, s, len;