~ubuntu-branches/ubuntu/precise/slurm-llnl/precise

« back to all changes in this revision

Viewing changes to src/smap/configure_functions.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2011-04-08 11:21:17 UTC
  • mfrom: (3.3.16 sid)
  • Revision ID: james.westby@ubuntu.com-20110408112117-nfnyq9dtm55hqoaw
Tags: 2.2.4-1
* New upstream releases 
* Cleaning spare file and directories, not belonging to the sources
  generated by the building process and not removed by distclean.
  Added debian/clean with spare files and rm -rf inside debian/rules
  for directories.
* Added new packages libslurm-perl, libslurmdb-perl, slurm-llnl-torque
  (Closes: #575822) thanks to Julien Blache

Show diffs side-by-side

added added

removed removed

Lines of Context:
407
407
                                        request->geometry[X] =
408
408
                                                xstrntol(&com[geoi],
409
409
                                                         NULL, diff,
410
 
                                                         HOSTLIST_BASE);
411
 
                                }
412
 
                                geoi += diff;
413
 
                                diff = geoi;
414
 
 
415
 
                                while(com[geoi-1]!='x' && geoi<len)
416
 
                                        geoi++;
417
 
                                if(geoi==len)
418
 
                                        goto geo_error_message;
419
 
                                diff = geoi - diff;
420
 
                                if(diff>1) {
421
 
                                        request->geometry[Y] =
422
 
                                                xstrntol(&com[geoi],
423
 
                                                         NULL, diff,
424
 
                                                         10);
425
 
                                } else {
426
 
                                        request->geometry[Y] =
427
 
                                                xstrntol(&com[geoi],
428
 
                                                         NULL, diff,
429
 
                                                         HOSTLIST_BASE);
430
 
                                }
431
 
                                geoi += diff;
432
 
                                diff = geoi;
433
 
                                while(com[geoi-1]!='x' && geoi<len)
434
 
                                        geoi++;
435
 
                                if(geoi==len)
436
 
                                        goto geo_error_message;
437
 
                                diff = geoi - diff;
438
 
 
439
 
                                if(diff>1) {
440
 
                                        request->geometry[Z] =
441
 
                                                xstrntol(&com[geoi],
442
 
                                                         NULL, diff,
443
 
                                                         10);
444
 
                                } else {
445
 
                                        request->geometry[Z] =
446
 
                                                xstrntol(&com[geoi],
447
 
                                                         NULL, diff,
448
 
                                                         HOSTLIST_BASE);
 
410
                                                         params.cluster_base);
 
411
                                }
 
412
                                geoi += diff;
 
413
                                diff = geoi;
 
414
 
 
415
                                while(com[geoi-1]!='x' && geoi<len)
 
416
                                        geoi++;
 
417
                                if(geoi==len)
 
418
                                        goto geo_error_message;
 
419
                                diff = geoi - diff;
 
420
                                if(diff>1) {
 
421
                                        request->geometry[Y] =
 
422
                                                xstrntol(&com[geoi],
 
423
                                                         NULL, diff,
 
424
                                                         10);
 
425
                                } else {
 
426
                                        request->geometry[Y] =
 
427
                                                xstrntol(&com[geoi],
 
428
                                                         NULL, diff,
 
429
                                                         params.cluster_base);
 
430
                                }
 
431
                                geoi += diff;
 
432
                                diff = geoi;
 
433
                                while(com[geoi-1]!='x' && geoi<len)
 
434
                                        geoi++;
 
435
                                if(geoi==len)
 
436
                                        goto geo_error_message;
 
437
                                diff = geoi - diff;
 
438
 
 
439
                                if(diff>1) {
 
440
                                        request->geometry[Z] =
 
441
                                                xstrntol(&com[geoi],
 
442
                                                         NULL, diff,
 
443
                                                         10);
 
444
                                } else {
 
445
                                        request->geometry[Z] =
 
446
                                                xstrntol(&com[geoi],
 
447
                                                         NULL, diff,
 
448
                                                         params.cluster_base);
449
449
                                }
450
450
                                request->size = -1;
451
451
                                break;
465
465
                        } else {
466
466
                                request->start[X] = xstrntol(&com[starti],
467
467
                                                             NULL, diff,
468
 
                                                             HOSTLIST_BASE);
 
468
                                                             params.
 
469
                                                             cluster_base);
469
470
                        }
470
471
                        starti += diff;
471
472
                        if(starti==len)
484
485
                        } else {
485
486
                                request->start[Y] = xstrntol(&com[starti],
486
487
                                                             NULL, diff,
487
 
                                                             HOSTLIST_BASE);
 
488
                                                             params.cluster_base);
488
489
                        }
489
490
                        starti += diff;
490
491
                        if(starti==len)
503
504
                        } else {
504
505
                                request->start[Z] = xstrntol(&com[starti],
505
506
                                                             NULL, diff,
506
 
                                                             HOSTLIST_BASE);
 
507
                                                             params.
 
508
                                                             cluster_base);
507
509
                        }
508
510
                }
509
511
        start_request:
571
573
#ifdef HAVE_BG_FILES
572
574
        int len=strlen(com);
573
575
        char *rack_mid = NULL;
574
 
        int *coord = NULL;
 
576
        uint16_t *coord = NULL;
575
577
#endif
576
578
 
577
579
        while(com[i] != '\0') {
631
633
        char allnodes[50];
632
634
        memset(allnodes,0,50);
633
635
 
634
 
#ifdef HAVE_3D
635
 
        sprintf(allnodes, "000x%c%c%c",
636
 
                alpha_num[DIM_SIZE[X]-1], alpha_num[DIM_SIZE[Y]-1],
637
 
                alpha_num[DIM_SIZE[Z]-1]);
638
 
#else
639
 
        sprintf(allnodes, "0-%d",
640
 
                DIM_SIZE[X]);
641
 
#endif
 
636
        if(params.cluster_dims == 3)
 
637
                sprintf(allnodes, "000x%c%c%c",
 
638
                        alpha_num[DIM_SIZE[X]-1], alpha_num[DIM_SIZE[Y]-1],
 
639
                        alpha_num[DIM_SIZE[Z]-1]);
 
640
        else
 
641
                sprintf(allnodes, "0-%d",
 
642
                        DIM_SIZE[X]);
 
643
 
642
644
        return _change_state_bps(allnodes, state);
643
645
 
644
646
}
646
648
{
647
649
        int i=0, x;
648
650
        int len = strlen(com);
649
 
        int start[SYSTEM_DIMENSIONS], end[SYSTEM_DIMENSIONS];
650
 
#ifdef HAVE_3D
 
651
        int start[params.cluster_dims], end[params.cluster_dims];
651
652
        int number=0, y=0, z=0, j=0;
652
 
#endif
653
653
        char letter = '.';
654
654
        char opposite = '#';
655
655
        bool used = false;
656
656
        char *c_state = "up";
 
657
        char *p = '\0';
657
658
 
658
659
        if(state == NODE_STATE_DOWN) {
659
660
                letter = '#';
674
675
                return 0;
675
676
        }
676
677
 
677
 
#ifdef HAVE_3D
 
678
        if(params.cluster_dims == 1) {
 
679
                if ((com[i+3] == 'x')
 
680
                    || (com[i+3] == '-')) {
 
681
                        start[X] =  xstrntol(com + i, NULL,
 
682
                                             params.cluster_dims,
 
683
                                             params.cluster_base);
 
684
                        i += 4;
 
685
                        end[X] =  xstrntol(com + i, NULL,
 
686
                                           params.cluster_dims,
 
687
                                           params.cluster_base);
 
688
                } else {
 
689
                        start[X] = end[X] =  xstrntol(com + i, NULL,
 
690
                                                      params.cluster_dims,
 
691
                                                      params.cluster_base);
 
692
                }
 
693
 
 
694
                if((start[X]>end[X])
 
695
                   || (start[X]<0)
 
696
                   || (end[X]>DIM_SIZE[X]-1))
 
697
                        goto error_message;
 
698
 
 
699
                for(x=start[X];x<=end[X];x++) {
 
700
                        ba_system_ptr->grid[x][0][0].color = 0;
 
701
                        ba_system_ptr->grid[x][0][0].letter = letter;
 
702
                        ba_system_ptr->grid[x][0][0].used = used;
 
703
                }
 
704
                return 1;
 
705
        }
 
706
 
678
707
        if ((com[i+3] == 'x')
679
708
            || (com[i+3] == '-')) {
680
709
                for(j=0; j<3; j++) {
685
714
                        goto error_message2;
686
715
 
687
716
                }
688
 
                number = xstrntol(com + i, NULL,
689
 
                                  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
690
 
                start[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
691
 
                start[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
692
 
                        / HOSTLIST_BASE;
693
 
                start[Z] = (number % HOSTLIST_BASE);
 
717
                number = xstrntol(com + i, &p, params.cluster_dims,
 
718
                                  params.cluster_base);
 
719
                hostlist_parse_int_to_array(
 
720
                        number, start, params.cluster_dims,
 
721
                        params.cluster_base);
694
722
 
695
723
                i += 4;
696
724
                for(j=0; j<3; j++) {
700
728
                                continue;
701
729
                        goto error_message2;
702
730
                }
703
 
                number = xstrntol(com + i, NULL,
704
 
                                  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
705
 
                end[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
706
 
                end[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
707
 
                        / HOSTLIST_BASE;
708
 
                end[Z] = (number % HOSTLIST_BASE);
 
731
                number = xstrntol(com + i, &p, params.cluster_dims,
 
732
                                  params.cluster_base);
 
733
                hostlist_parse_int_to_array(
 
734
                        number, end, params.cluster_dims,
 
735
                        params.cluster_base);
709
736
        } else {
710
737
                for(j=0; j<3; j++) {
711
738
                        if (((i+j) <= len) &&
714
741
                                continue;
715
742
                        goto error_message2;
716
743
                }
717
 
                number = xstrntol(com + i, NULL,
718
 
                                  BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
719
 
                start[X] = end[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
720
 
                start[Y] = end[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
721
 
                        / HOSTLIST_BASE;
722
 
                start[Z] = end[Z] = (number % HOSTLIST_BASE);
 
744
                number = xstrntol(com + i, &p, params.cluster_dims,
 
745
                                  params.cluster_base);
 
746
                hostlist_parse_int_to_array(
 
747
                        number, start, params.cluster_dims,
 
748
                        params.cluster_base);
723
749
        }
724
750
        if((start[X]>end[X]
725
751
            || start[Y]>end[Y]
744
770
                        }
745
771
                }
746
772
        }
747
 
#else
748
 
        if ((com[i+3] == 'x')
749
 
            || (com[i+3] == '-')) {
750
 
                start[X] =  xstrntol(com + i, NULL,
751
 
                                    BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
752
 
                i += 4;
753
 
                end[X] =  xstrntol(com + i, NULL,
754
 
                                   BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
755
 
        } else {
756
 
                start[X] = end[X] =  xstrntol(com + i, NULL,
757
 
                                              BA_SYSTEM_DIMENSIONS,
758
 
                                              HOSTLIST_BASE);
759
 
        }
760
 
 
761
 
        if((start[X]>end[X])
762
 
           || (start[X]<0)
763
 
           || (end[X]>DIM_SIZE[X]-1))
764
 
                goto error_message;
765
 
 
766
 
        for(x=start[X];x<=end[X];x++) {
767
 
                ba_system_ptr->grid[x].color = 0;
768
 
                ba_system_ptr->grid[x].letter = letter;
769
 
                ba_system_ptr->grid[x].used = used;
770
 
        }
771
 
#endif
772
773
        return 1;
773
774
error_message:
774
775
        memset(error_string,0,255);
775
 
#ifdef HAVE_BG
776
 
        sprintf(error_string,
777
 
                "Problem with base partitions, "
778
 
                "specified range was %d%d%dx%d%d%d",
779
 
                alpha_num[start[X]],alpha_num[start[Y]],alpha_num[start[Z]],
780
 
                alpha_num[end[X]],alpha_num[end[Y]],alpha_num[end[Z]]);
781
 
#else
782
 
        sprintf(error_string,
783
 
                "Problem with nodes,  specified range was %d-%d",
784
 
                start[X],end[X]);
785
 
#endif
 
776
        if(params.cluster_dims == 1) {
 
777
                sprintf(error_string,
 
778
                        "Problem with nodes,  specified range was %d-%d",
 
779
                        start[X],end[X]);
 
780
        } else {
 
781
                sprintf(error_string,
 
782
                        "Problem with base partitions, "
 
783
                        "specified range was %d%d%dx%d%d%d",
 
784
                        alpha_num[start[X]],alpha_num[start[Y]],
 
785
                        alpha_num[start[Z]],
 
786
                        alpha_num[end[X]],alpha_num[end[Y]],alpha_num[end[Z]]);
 
787
        }
786
788
        return 0;
787
 
#ifdef HAVE_3D
788
789
error_message2:
789
790
        memset(error_string,0,255);
790
791
        sprintf(error_string,
792
793
                "You need to specify XYZ or XYZxXYZ",
793
794
                com+i,com);
794
795
        return 0;
795
 
#endif
796
796
}
797
797
static int _remove_allocation(char *com, List allocated_blocks)
798
798
{
905
905
 
906
906
        if(i<=len) {
907
907
                /* Here we are looking for a real number for the count
908
 
                   instead of the HOSTLIST_BASE so atoi is ok
 
908
                   instead of the params.cluster_base so atoi is ok
909
909
                */
910
910
                if(com[i]>='0' && com[i]<='9')
911
911
                        count = atoi(com+i);
1126
1126
        int bp_count = 0;
1127
1127
        int diff=0;
1128
1128
        int largest_diff=-1;
1129
 
        int start[BA_SYSTEM_DIMENSIONS];
1130
 
        int end[BA_SYSTEM_DIMENSIONS];
1131
 
        int start1[BA_SYSTEM_DIMENSIONS];
1132
 
        int end1[BA_SYSTEM_DIMENSIONS];
1133
 
        int geo[BA_SYSTEM_DIMENSIONS];
 
1129
        int start[params.cluster_dims];
 
1130
        int end[params.cluster_dims];
 
1131
        int start1[params.cluster_dims];
 
1132
        int end1[params.cluster_dims];
 
1133
        int geo[params.cluster_dims];
1134
1134
        char com[255];
1135
1135
        int j = 0, number;
1136
1136
        int len = 0;
1137
1137
        int x,y,z;
 
1138
        char *p = '\0';
1138
1139
 
1139
1140
        geo[X] = 0;
1140
1141
        geo[Y] = 0;
1172
1173
                    && (nodes[j+8] == ']' || nodes[j+8] == ',')
1173
1174
                    && (nodes[j+4] == 'x' || nodes[j+4] == '-')) {
1174
1175
                        j++;
1175
 
                        number = xstrntol(nodes + j, NULL,
1176
 
                                          BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
1177
 
                        start[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
1178
 
                        start[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
1179
 
                                / HOSTLIST_BASE;
1180
 
                        start[Z] = (number % HOSTLIST_BASE);
1181
 
 
 
1176
                        number = xstrntol(nodes + j, &p, params.cluster_dims,
 
1177
                                          params.cluster_base);
 
1178
                        hostlist_parse_int_to_array(
 
1179
                                number, start, params.cluster_dims,
 
1180
                                params.cluster_base);
1182
1181
                        j += 4;
1183
 
                        number = xstrntol(nodes + j, NULL,
1184
 
                                          BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
1185
 
                        end[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
1186
 
                        end[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
1187
 
                                / HOSTLIST_BASE;
1188
 
                        end[Z] = (number % HOSTLIST_BASE);
1189
 
 
 
1182
                        number = xstrntol(nodes + j, &p, params.cluster_dims,
 
1183
                                          params.cluster_base);
 
1184
                        hostlist_parse_int_to_array(
 
1185
                                number, end, params.cluster_dims,
 
1186
                                params.cluster_base);
1190
1187
                        j += 3;
1191
1188
                        diff = end[X]-start[X];
1192
1189
                        if(diff > largest_diff) {
1216
1213
                        j--;
1217
1214
                } else if((nodes[j] >= '0' && nodes[j] <= '9')
1218
1215
                          || (nodes[j] >= 'A' && nodes[j] <= 'Z')) {
1219
 
                        number = xstrntol(nodes + j, NULL,
1220
 
                                          BA_SYSTEM_DIMENSIONS, HOSTLIST_BASE);
1221
 
                        start[X] = number / (HOSTLIST_BASE * HOSTLIST_BASE);
1222
 
                        start[Y] = (number % (HOSTLIST_BASE * HOSTLIST_BASE))
1223
 
                                / HOSTLIST_BASE;
1224
 
                        start[Z] = (number % HOSTLIST_BASE);
1225
 
 
 
1216
                        number = xstrntol(nodes + j, &p, params.cluster_dims,
 
1217
                                          params.cluster_base);
 
1218
                        hostlist_parse_int_to_array(
 
1219
                                number, start, params.cluster_dims,
 
1220
                                params.cluster_base);
1226
1221
                        j+=3;
1227
1222
                        diff = 0;
1228
1223
                        if(diff > largest_diff) {
1303
1298
        }
1304
1299
 
1305
1300
        tbl = s_p_hashtbl_create(bg_conf_file_options);
1306
 
        if(s_p_parse_file(tbl, filename) == SLURM_ERROR) {
 
1301
        if(s_p_parse_file(tbl, NULL, filename) == SLURM_ERROR) {
1307
1302
                memset(error_string,0,255);
1308
1303
                sprintf(error_string, "ERROR: couldn't open/read %s",
1309
1304
                        filename);