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

« back to all changes in this revision

Viewing changes to src/plugins/select/bluegene/plugin/select_bluegene.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:
1
1
/*****************************************************************************\
2
2
 *  select_bluegene.c - node selection plugin for Blue Gene system.
3
 
 * 
4
 
 *  $Id: select_bluegene.c 17175 2009-04-07 17:24:20Z da $
5
3
 *****************************************************************************
6
 
 *  Copyright (C) 2004-2006 The Regents of the University of California.
 
4
 *  Copyright (C) 2004-2007 The Regents of the University of California.
 
5
 *  Copyright (C) 2008-2009 Lawrence Livermore National Security.
7
6
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
8
7
 *  Written by Dan Phung <phung4@llnl.gov> Danny Auble <da@llnl.gov>
9
 
 *  LLNL-CODE-402394.
 
8
 *  CODE-OCEC-09-009. All rights reserved.
10
9
 *  
11
10
 *  This file is part of SLURM, a resource management program.
12
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
11
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
12
 *  Please also read the included file: DISCLAIMER.
13
13
 *  
14
14
 *  SLURM is free software; you can redistribute it and/or modify it under
15
15
 *  the terms of the GNU General Public License as published by the Free
39
39
 
40
40
#include "bluegene.h"
41
41
 
42
 
#ifndef HAVE_BG
43
 
#include "defined_block.h"
44
 
#endif
45
 
 
46
42
//#include "src/common/uid.h"
47
43
#include "src/slurmctld/trigger_mgr.h"
48
44
#include <fcntl.h>
49
45
 
50
46
#define HUGE_BUF_SIZE (1024*16)
51
47
 
52
 
/* global */
53
 
int procs_per_node = 512;
54
 
 
55
48
/*
56
49
 * These variables are required by the generic plugin interface.  If they
57
50
 * are not found in the plugin, the plugin loader will ignore it.
101
94
 */
102
95
extern int init ( void )
103
96
{
104
 
#ifndef HAVE_BG
105
 
        fatal("Plugin select/bluegene is illegal on non-BlueGene computers");
106
 
#endif
 
97
 
107
98
#if (SYSTEM_DIMENSIONS != 3)
108
99
        fatal("SYSTEM_DIMENSIONS value (%d) invalid for Blue Gene",
109
100
                SYSTEM_DIMENSIONS);
164
155
{
165
156
        static char tmp[16];
166
157
 
167
 
#ifdef HAVE_BG
168
158
        switch (state) {
169
159
                case 0: 
170
160
                        return "ERROR";
171
161
                case 1:
172
162
                        return "FREE";
173
163
        }
174
 
#endif
175
164
 
176
165
        snprintf(tmp, sizeof(tmp), "%d", state);
177
166
        return tmp;
209
198
 */
210
199
 extern int select_p_block_init(List part_list)
211
200
{
212
 
        xfree(bg_slurm_user_name);
213
 
        xfree(bg_slurm_node_prefix);
214
 
 
215
 
        slurm_conf_lock();
216
 
        xassert(slurmctld_conf.slurm_user_name);
217
 
        xassert(slurmctld_conf.node_prefix);
218
 
        bg_slurm_user_name = xstrdup(slurmctld_conf.slurm_user_name);
219
 
        bg_slurm_node_prefix = xstrdup(slurmctld_conf.node_prefix);
220
 
        slurm_conf_unlock();    
221
 
 
222
 
#ifdef HAVE_BG
 
201
        /* select_p_node_init needs to be called before this to set
 
202
           this up correctly
 
203
        */
223
204
        if(read_bg_conf() == SLURM_ERROR) {
224
205
                fatal("Error, could not read the file");
225
206
                return SLURM_ERROR;
226
207
        }
 
208
        
227
209
        if(part_list) {
228
210
                struct part_record *part_ptr = NULL;
229
211
                ListIterator itr = list_iterator_create(part_list);
237
219
                }
238
220
                list_iterator_destroy(itr);
239
221
        }
240
 
#else
241
 
        /*looking for blocks only I created */
242
 
        if (create_defined_blocks(bluegene_layout_mode, NULL) 
243
 
                        == SLURM_ERROR) {
244
 
                /* error in creating the static blocks, so
245
 
                 * blocks referenced by submitted jobs won't
246
 
                 * correspond to actual slurm blocks.
247
 
                 */
248
 
                fatal("Error, could not create the static blocks");
249
 
                return SLURM_ERROR;
250
 
        }
251
 
#endif
252
222
 
253
223
        return SLURM_SUCCESS; 
254
224
}
274
244
 
275
245
        /* write block records to buffer */
276
246
        slurm_mutex_lock(&block_state_mutex);
277
 
        itr = list_iterator_create(bg_list);
 
247
        itr = list_iterator_create(bg_lists->main);
278
248
        while((bg_record = list_next(itr))) {
279
249
                /* on real bluegene systems we only want to keep track of
280
250
                 * the blocks in an error state
333
303
                (void) unlink(new_file);
334
304
        else {                  /* file shuffle */
335
305
                (void) unlink(old_file);
336
 
                (void) link(reg_file, old_file);
 
306
                if(link(reg_file, old_file))
 
307
                        debug4("unable to create link for %s -> %s: %m",
 
308
                               reg_file, old_file);
337
309
                (void) unlink(reg_file);
338
 
                (void) link(new_file, reg_file);
 
310
                if(link(new_file, reg_file))
 
311
                        debug4("unable to create link for %s -> %s: %m",
 
312
                               new_file, reg_file);
339
313
                (void) unlink(new_file);
340
314
        }
341
315
        xfree(old_file);
360
334
        return sync_jobs(job_list);
361
335
}
362
336
 
363
 
/* All initialization is performed by select_p_block_init() */
 
337
/* All initialization is performed by init() */
364
338
extern int select_p_node_init(struct node_record *node_ptr, int node_cnt)
365
339
{
366
340
        if(node_cnt>0)
367
 
                if(node_ptr->cpus >= bluegene_bp_node_cnt)
368
 
                        procs_per_node = node_ptr->cpus;
 
341
                if(node_ptr->cpus >= bg_conf->bp_node_cnt) 
 
342
                        bg_conf->procs_per_bp = node_ptr->cpus;
 
343
                
369
344
        return SLURM_SUCCESS;
370
345
}
371
346
 
442
417
        return ESLURM_NOT_SUPPORTED;
443
418
}
444
419
 
445
 
extern int select_p_get_job_cores(uint32_t job_id, int alloc_index, int s)
446
 
{
447
 
        return ESLURM_NOT_SUPPORTED;
448
 
}
449
 
 
450
420
extern int select_p_job_ready(struct job_record *job_ptr)
451
421
{
452
 
#ifdef HAVE_BG_FILES
453
422
        return block_ready(job_ptr);
454
 
#else
455
 
        if (job_ptr->job_state == JOB_RUNNING)
456
 
                return 1;
457
 
        return 0;
458
 
#endif
459
423
}
460
424
 
461
425
extern int select_p_pack_node_info(time_t last_query_time, Buf *buffer_ptr)
476
440
                pack32(blocks_packed, buffer);
477
441
                pack_time(last_bg_update, buffer);
478
442
 
479
 
                if(bg_list) {
 
443
                if(bg_lists->main) {
480
444
                        slurm_mutex_lock(&block_state_mutex);
481
 
                        itr = list_iterator_create(bg_list);
 
445
                        itr = list_iterator_create(bg_lists->main);
482
446
                        while ((bg_record = list_next(itr))) {
483
447
                                pack_block(bg_record, buffer);
484
448
                                blocks_packed++;
486
450
                        list_iterator_destroy(itr);
487
451
                        slurm_mutex_unlock(&block_state_mutex);
488
452
                } else {
489
 
                        error("select_p_pack_node_info: no bg_list");
 
453
                        error("select_p_pack_node_info: no bg_lists->main");
490
454
                        return SLURM_ERROR;
491
455
                }
492
456
                /*
493
457
                 * get all the blocks we are freeing since they have
494
458
                 * been moved here
495
459
                 */
496
 
                if(bg_freeing_list) {
 
460
                if(bg_lists->freeing) {
497
461
                        slurm_mutex_lock(&block_state_mutex);
498
 
                        itr = list_iterator_create(bg_freeing_list);
 
462
                        itr = list_iterator_create(bg_lists->freeing);
499
463
                        while ((bg_record = (bg_record_t *) list_next(itr)) 
500
464
                               != NULL) {
501
465
                                xassert(bg_record->bg_block_id != NULL);
513
477
                
514
478
                *buffer_ptr = buffer;
515
479
        } else {
516
 
                error("select_p_pack_node_info: bg_list not ready yet");
 
480
                error("select_p_pack_node_info: bg_lists->main not ready yet");
517
481
                return SLURM_ERROR;
518
482
        }
519
483
 
540
504
        time_t now;
541
505
        char reason[128], tmp[64], time_str[32];
542
506
 
543
 
        bg_record = find_bg_record_in_list(bg_list, part_desc_ptr->name);
 
507
        bg_record = find_bg_record_in_list(bg_lists->main, part_desc_ptr->name);
544
508
        if(!bg_record)
545
509
                return SLURM_ERROR;
546
510
 
566
530
        
567
531
        /* Free all overlapping blocks and kill any jobs only
568
532
         * if we are going into an error state */ 
569
 
        if (bluegene_layout_mode != LAYOUT_DYNAMIC
 
533
        if (bg_conf->layout_mode != LAYOUT_DYNAMIC
570
534
            && !part_desc_ptr->state_up) {
571
535
                bg_record_t *found_record = NULL;
572
536
                ListIterator itr;
573
537
                List delete_list = list_create(NULL);
574
538
                
575
539
                slurm_mutex_lock(&block_state_mutex);
576
 
                itr = list_iterator_create(bg_list);
 
540
                itr = list_iterator_create(bg_lists->main);
577
541
                while ((found_record = list_next(itr))) {
578
542
                        if (bg_record == found_record)
579
543
                                continue;
608
572
                                       bg_record->bg_block_id); 
609
573
                        }
610
574
                        list_push(delete_list, found_record);
611
 
                        num_block_to_free++;
612
575
                }               
613
576
                list_iterator_destroy(itr);
614
577
                free_block_list(delete_list);
621
584
        } else if(part_desc_ptr->state_up){
622
585
                resume_block(bg_record);
623
586
        } else {
 
587
                error("state is ? %d", part_desc_ptr->state_up);
624
588
                return rc;
625
589
        }
626
590
                                
627
591
        info("%s", reason);
628
592
        last_bg_update = time(NULL);
 
593
 
629
594
        return rc;
630
595
}
631
596
 
639
604
        double nc_pos = 0, last_pos = -1;
640
605
        bitstr_t *ionode_bitmap = NULL;
641
606
        
642
 
        if(bluegene_layout_mode != LAYOUT_DYNAMIC) {
 
607
        if(bg_conf->layout_mode != LAYOUT_DYNAMIC) {
643
608
                info("You can't use this call unless you are on a Dynamically "
644
609
                     "allocated system.  Please use update BlockName instead");
645
610
                rc = SLURM_ERROR;
692
657
                                rc = SLURM_ERROR;
693
658
                                goto end_it;
694
659
                        }
 
660
                        /* make sure we are asking for a correct name */
695
661
                        for(i = 0; i < BA_SYSTEM_DIMENSIONS; i++) {
696
 
                                if((part_desc_ptr->name[i] >= '0'
697
 
                                    && part_desc_ptr->name[i] <= '9')
698
 
                                   || (part_desc_ptr->name[i] >= 'A'
699
 
                                      && part_desc_ptr->name[i] <= 'Z')) {
700
 
                                        error("update_sub_node: "
701
 
                                              "misformatted name given %s",
702
 
                                              part_desc_ptr->name);
703
 
                                        rc = SLURM_ERROR;
704
 
                                        goto end_it;
705
 
                                }
 
662
                                if((part_desc_ptr->name[j+i] >= '0'
 
663
                                    && part_desc_ptr->name[j+i] <= '9')
 
664
                                   || (part_desc_ptr->name[j+i] >= 'A'
 
665
                                      && part_desc_ptr->name[j+i] <= 'Z')) 
 
666
                                        continue;
 
667
                                
 
668
                                error("update_sub_node: "
 
669
                                      "misformatted name given %s",
 
670
                                      part_desc_ptr->name);
 
671
                                rc = SLURM_ERROR;
 
672
                                goto end_it;
706
673
                        }
707
674
                        
708
675
                        strncpy(coord, part_desc_ptr->name+j,
719
686
                rc = SLURM_ERROR;
720
687
                goto end_it;
721
688
        }
722
 
        ionode_bitmap = bit_alloc(bluegene_numpsets);
 
689
        ionode_bitmap = bit_alloc(bg_conf->numpsets);
723
690
        bit_unfmt(ionode_bitmap, ionodes);
724
691
        if(bit_ffs(ionode_bitmap) == -1) {
725
692
                error("update_sub_node: Invalid ionode '%s' given.", ionodes);
727
694
                FREE_NULL_BITMAP(ionode_bitmap);
728
695
                goto end_it;            
729
696
        }
730
 
        node_name = xstrdup_printf("%s%s", bg_slurm_node_prefix, coord);
 
697
        node_name = xstrdup_printf("%s%s", bg_conf->slurm_node_prefix, coord);
731
698
        /* find out how many nodecards to get for each ionode */
732
699
        if(!part_desc_ptr->state_up) {
733
700
                info("Admin setting %s[%s] in an error state",
734
701
                     node_name, ionodes);
735
 
                for(i = 0; i<bluegene_numpsets; i++) {
 
702
                for(i = 0; i<bg_conf->numpsets; i++) {
736
703
                        if(bit_test(ionode_bitmap, i)) {
737
704
                                if((int)nc_pos != (int)last_pos) {
738
 
                                        down_nodecard(node_name, i);
 
705
                                        /* find first bit in nc */
 
706
                                        int start_io = 
 
707
                                                (int)nc_pos * bg_conf->io_ratio;
 
708
                                        down_nodecard(node_name, start_io);
739
709
                                        last_pos = nc_pos;
740
710
                                }
741
711
                        }
742
 
                        nc_pos += bluegene_nc_ratio;
 
712
                        nc_pos += bg_conf->nc_ratio;
743
713
                }
744
714
        } else if(part_desc_ptr->state_up){
745
715
                info("Admin setting %s[%s] in an free state",
759
729
        return rc;
760
730
}
761
731
 
762
 
extern int select_p_get_extra_jobinfo (struct node_record *node_ptr, 
763
 
                                       struct job_record *job_ptr, 
764
 
                                       enum select_data_info info,
765
 
                                       void *data)
766
 
{
767
 
        if (info == SELECT_AVAIL_CPUS) {
768
 
                /* Needed to track CPUs allocated to jobs on whole nodes
769
 
                 * for sched/wiki2 (Moab scheduler). Small block allocations
770
 
                 * handled through use of job_ptr->num_procs in slurmctld */
771
 
                uint16_t *cpus_per_bp = (uint16_t *) data;
772
 
                *cpus_per_bp = procs_per_node;
773
 
        }
774
 
        return SLURM_SUCCESS;
775
 
}
776
 
 
777
732
extern int select_p_get_info_from_plugin (enum select_data_info info, 
 
733
                                          struct job_record *job_ptr,
778
734
                                          void *data)
779
735
{
 
736
        if (info == SELECT_STATIC_PART) {
 
737
                uint16_t *tmp16 = (uint16_t *) data;
 
738
                if (bg_conf->layout_mode == LAYOUT_STATIC)
 
739
                        *tmp16 = 1;
 
740
                else
 
741
                        *tmp16 = 0;
 
742
        }
 
743
 
 
744
        return SLURM_SUCCESS;
 
745
}
 
746
 
 
747
extern int select_p_update_node_config (int index)
 
748
{
780
749
        return SLURM_SUCCESS;
781
750
}
782
751
 
783
752
extern int select_p_update_node_state (int index, uint16_t state)
784
753
{
785
 
        int x;
786
 
#ifdef HAVE_BG
787
 
        int y, z;
788
 
        
 
754
        int x, y, z;
789
755
        for (y = DIM_SIZE[Y] - 1; y >= 0; y--) {
790
756
                for (z = 0; z < DIM_SIZE[Z]; z++) {
791
757
                        for (x = 0; x < DIM_SIZE[X]; x++) {
799
765
                        }
800
766
                }
801
767
        }
802
 
#else
803
 
        for (x = 0; x < DIM_SIZE[X]; x++) {
804
 
                if (ba_system_ptr->grid[x].index == index) {
805
 
                        ba_update_node_state(&ba_system_ptr->grid[x], state);
806
 
                        return SLURM_SUCCESS;
807
 
                }
808
 
        }
809
 
#endif
 
768
 
810
769
        return SLURM_ERROR;
811
770
}
812
771
 
817
776
        int i;
818
777
        uint16_t req_geometry[BA_SYSTEM_DIMENSIONS];
819
778
 
820
 
        if(!bluegene_bp_node_cnt) {
 
779
        if(!bg_conf->bp_node_cnt) {
821
780
                fatal("select_g_alter_node_cnt: This can't be called "
822
 
                      "before select_g_block_init");
 
781
                      "before init");
823
782
        }
824
783
 
825
784
        switch (type) {
826
785
        case SELECT_GET_NODE_SCALING:
827
786
                if((*nodes) != INFINITE)
828
 
                        (*nodes) = bluegene_bp_node_cnt;
 
787
                        (*nodes) = bg_conf->bp_node_cnt;
829
788
                break;
830
789
        case SELECT_SET_BP_CNT:
831
790
                if(((*nodes) == INFINITE) || ((*nodes) == NO_VAL))
832
791
                        tmp = (*nodes);
833
 
                else if((*nodes) > bluegene_bp_node_cnt) {
 
792
                else if((*nodes) > bg_conf->bp_node_cnt) {
834
793
                        tmp = (*nodes);
835
 
                        tmp /= bluegene_bp_node_cnt;
 
794
                        tmp /= bg_conf->bp_node_cnt;
836
795
                        if(tmp < 1) 
837
796
                                tmp = 1;
838
797
                } else 
846
805
                         * don't scale up this value. */
847
806
                        break;
848
807
                }
849
 
                (*nodes) *= bluegene_bp_node_cnt;
 
808
                (*nodes) *= bg_conf->bp_node_cnt;
850
809
                break;
851
810
        case SELECT_APPLY_NODE_MAX_OFFSET:
852
811
                if((*nodes) != INFINITE)
853
 
                        (*nodes) *= bluegene_bp_node_cnt;
 
812
                        (*nodes) *= bg_conf->bp_node_cnt;
854
813
                break;
855
814
        case SELECT_SET_NODE_CNT:
856
815
                select_g_get_jobinfo(job_desc->select_jobinfo,
877
836
                        for (i=0; i<BA_SYSTEM_DIMENSIONS; i++)
878
837
                                job_desc->min_nodes *= 
879
838
                                        (uint16_t)req_geometry[i];
880
 
                        job_desc->min_nodes *= bluegene_bp_node_cnt;
 
839
                        job_desc->min_nodes *= bg_conf->bp_node_cnt;
881
840
                        job_desc->max_nodes = job_desc->min_nodes;
882
841
                }
883
842
 
884
843
                if(job_desc->num_procs != NO_VAL) {
 
844
                        job_desc->num_procs /= bg_conf->proc_ratio;
885
845
                        if(job_desc->min_nodes < job_desc->num_procs)
886
846
                                job_desc->min_nodes = job_desc->num_procs;
887
847
                        if(job_desc->max_nodes < job_desc->num_procs)
888
848
                                job_desc->max_nodes = job_desc->num_procs;
889
849
                }
890
850
                /* See if min_nodes is greater than one base partition */
891
 
                if(job_desc->min_nodes > bluegene_bp_node_cnt) {
 
851
                if(job_desc->min_nodes > bg_conf->bp_node_cnt) {
892
852
                        /*
893
853
                         * if it is make sure it is a factor of 
894
 
                         * bluegene_bp_node_cnt, if it isn't make it 
 
854
                         * bg_conf->bp_node_cnt, if it isn't make it 
895
855
                         * that way 
896
856
                         */
897
 
                        tmp = job_desc->min_nodes % bluegene_bp_node_cnt;
 
857
                        tmp = job_desc->min_nodes % bg_conf->bp_node_cnt;
898
858
                        if(tmp > 0)
899
859
                                job_desc->min_nodes += 
900
 
                                        (bluegene_bp_node_cnt-tmp);
 
860
                                        (bg_conf->bp_node_cnt-tmp);
901
861
                }                               
902
 
                tmp = job_desc->min_nodes / bluegene_bp_node_cnt;
 
862
                tmp = job_desc->min_nodes / bg_conf->bp_node_cnt;
903
863
                
904
864
                /* this means it is greater or equal to one bp */
905
865
                if(tmp > 0) {
907
867
                                             SELECT_DATA_NODE_CNT,
908
868
                                             &job_desc->min_nodes);
909
869
                        job_desc->min_nodes = tmp;
910
 
                        job_desc->num_procs = procs_per_node * tmp;
 
870
                        job_desc->num_procs = bg_conf->procs_per_bp * tmp;
911
871
                } else { 
912
872
#ifdef HAVE_BGL
913
 
                        if(job_desc->min_nodes <= bluegene_nodecard_node_cnt
914
 
                           && bluegene_nodecard_ionode_cnt)
 
873
                        if(job_desc->min_nodes <= bg_conf->nodecard_node_cnt
 
874
                           && bg_conf->nodecard_ionode_cnt)
915
875
                                job_desc->min_nodes = 
916
 
                                        bluegene_nodecard_node_cnt;
 
876
                                        bg_conf->nodecard_node_cnt;
917
877
                        else if(job_desc->min_nodes 
918
 
                                <= bluegene_quarter_node_cnt)
 
878
                                <= bg_conf->quarter_node_cnt)
919
879
                                job_desc->min_nodes = 
920
 
                                        bluegene_quarter_node_cnt;
 
880
                                        bg_conf->quarter_node_cnt;
921
881
                        else 
922
882
                                job_desc->min_nodes = 
923
 
                                        bluegene_bp_node_cnt;
 
883
                                        bg_conf->bp_node_cnt;
924
884
                        
925
885
                        select_g_set_jobinfo(job_desc->select_jobinfo,
926
886
                                             SELECT_DATA_NODE_CNT,
927
887
                                             &job_desc->min_nodes);
928
888
 
929
 
                        tmp = bluegene_bp_node_cnt/job_desc->min_nodes;
 
889
                        tmp = bg_conf->bp_node_cnt/job_desc->min_nodes;
930
890
                        
931
 
                        job_desc->num_procs = procs_per_node/tmp;
 
891
                        job_desc->num_procs = bg_conf->procs_per_bp/tmp;
932
892
                        job_desc->min_nodes = 1;
933
893
#else
934
 
                        i = bluegene_smallest_block;
935
 
                        while(i <= bluegene_bp_node_cnt) {
 
894
                        i = bg_conf->smallest_block;
 
895
                        while(i <= bg_conf->bp_node_cnt) {
936
896
                                if(job_desc->min_nodes <= i) {
937
897
                                        job_desc->min_nodes = i;
938
898
                                        break;
945
905
                                             &job_desc->min_nodes);
946
906
 
947
907
                        job_desc->num_procs = job_desc->min_nodes 
948
 
                                * bluegene_proc_ratio;
 
908
                                * bg_conf->proc_ratio;
949
909
                        job_desc->min_nodes = 1;
950
910
#endif
951
911
                }
953
913
                if(job_desc->max_nodes == (uint32_t) NO_VAL) 
954
914
                        return SLURM_SUCCESS;
955
915
                
956
 
                if(job_desc->max_nodes > bluegene_bp_node_cnt) {
957
 
                        tmp = job_desc->max_nodes % bluegene_bp_node_cnt;
 
916
                if(job_desc->max_nodes > bg_conf->bp_node_cnt) {
 
917
                        tmp = job_desc->max_nodes % bg_conf->bp_node_cnt;
958
918
                        if(tmp > 0)
959
919
                                job_desc->max_nodes += 
960
 
                                        (bluegene_bp_node_cnt-tmp);
 
920
                                        (bg_conf->bp_node_cnt-tmp);
961
921
                }
962
 
                tmp = job_desc->max_nodes / bluegene_bp_node_cnt;
 
922
                tmp = job_desc->max_nodes / bg_conf->bp_node_cnt;
963
923
                if(tmp > 0) {
964
924
                        job_desc->max_nodes = tmp;
965
925
                        tmp = NO_VAL;
966
926
                } else {
967
927
#ifdef HAVE_BGL
968
 
                        if(job_desc->max_nodes <= bluegene_nodecard_node_cnt
969
 
                           && bluegene_nodecard_ionode_cnt)
 
928
                        if(job_desc->max_nodes <= bg_conf->nodecard_node_cnt
 
929
                           && bg_conf->nodecard_ionode_cnt)
970
930
                                job_desc->max_nodes = 
971
 
                                        bluegene_nodecard_node_cnt;
 
931
                                        bg_conf->nodecard_node_cnt;
972
932
                        else if(job_desc->max_nodes 
973
 
                                <= bluegene_quarter_node_cnt)
 
933
                                <= bg_conf->quarter_node_cnt)
974
934
                                job_desc->max_nodes = 
975
 
                                        bluegene_quarter_node_cnt;
 
935
                                        bg_conf->quarter_node_cnt;
976
936
                        else 
977
937
                                job_desc->max_nodes = 
978
 
                                        bluegene_bp_node_cnt;
 
938
                                        bg_conf->bp_node_cnt;
979
939
                
980
 
                        tmp = bluegene_bp_node_cnt/job_desc->max_nodes;
981
 
                        tmp = procs_per_node/tmp;
 
940
                        tmp = bg_conf->bp_node_cnt/job_desc->max_nodes;
 
941
                        tmp = bg_conf->procs_per_bp/tmp;
982
942
                        
983
943
                        select_g_set_jobinfo(job_desc->select_jobinfo,
984
944
                                             SELECT_DATA_MAX_PROCS, 
985
945
                                             &tmp);
986
946
                        job_desc->max_nodes = 1;
987
947
#else
988
 
                        i = bluegene_smallest_block;
989
 
                        while(i <= bluegene_bp_node_cnt) {
 
948
                        i = bg_conf->smallest_block;
 
949
                        while(i <= bg_conf->bp_node_cnt) {
990
950
                                if(job_desc->max_nodes <= i) {
991
951
                                        job_desc->max_nodes = i;
992
952
                                        break;
994
954
                                i *= 2;
995
955
                        }
996
956
                        
997
 
                        tmp = job_desc->max_nodes * bluegene_proc_ratio;
 
957
                        tmp = job_desc->max_nodes * bg_conf->proc_ratio;
998
958
                        select_g_set_jobinfo(job_desc->select_jobinfo,
999
959
                                             SELECT_DATA_MAX_PROCS,
1000
960
                                             &tmp);
1014
974
 
1015
975
extern int select_p_reconfigure(void)
1016
976
{
1017
 
        return SLURM_SUCCESS;
1018
 
}
1019
 
 
1020
 
extern int select_p_step_begin(struct step_record *step_ptr)
1021
 
{
1022
 
        return SLURM_SUCCESS;
1023
 
}
1024
 
 
1025
 
extern int select_p_step_fini(struct step_record *step_ptr)
1026
 
{
1027
 
        return SLURM_SUCCESS;
 
977
        slurm_conf_lock();
 
978
        if(!slurmctld_conf.slurm_user_name 
 
979
           || strcmp(bg_conf->slurm_user_name, slurmctld_conf.slurm_user_name))
 
980
                error("The slurm user has changed from '%s' to '%s'.  "
 
981
                      "If this is really what you "
 
982
                      "want you will need to restart slurm for this "
 
983
                      "change to be enforced in the bluegene plugin.",
 
984
                      bg_conf->slurm_user_name, slurmctld_conf.slurm_user_name);
 
985
        if(!slurmctld_conf.node_prefix
 
986
           || strcmp(bg_conf->slurm_node_prefix, slurmctld_conf.node_prefix))
 
987
                error("Node Prefix has changed from '%s' to '%s'.  "
 
988
                      "If this is really what you "
 
989
                      "want you will need to restart slurm for this "
 
990
                      "change to be enforced in the bluegene plugin.",
 
991
                      bg_conf->slurm_node_prefix, slurmctld_conf.node_prefix);
 
992
        slurm_conf_unlock();    
 
993
 
 
994
        return SLURM_SUCCESS;
 
995
}
 
996
 
 
997
extern List select_p_get_config(void)
 
998
{
 
999
        config_key_pair_t *key_pair;
 
1000
        List my_list = list_create(destroy_config_key_pair);
 
1001
 
 
1002
        if (!my_list)
 
1003
                fatal("malloc failure on list_create");
 
1004
 
 
1005
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1006
        key_pair->name = xstrdup("BasePartitionNodeCnt");
 
1007
        key_pair->value = xstrdup_printf("%u", bg_conf->bp_node_cnt);
 
1008
        list_append(my_list, key_pair);
 
1009
 
 
1010
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1011
        key_pair->name = xstrdup("NodeCPUCnt");
 
1012
        key_pair->value = xstrdup_printf("%u", bg_conf->proc_ratio);
 
1013
        list_append(my_list, key_pair);
 
1014
 
 
1015
 
 
1016
#ifdef HAVE_BGL
 
1017
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1018
        key_pair->name = xstrdup("BlrtsImage");
 
1019
        key_pair->value = xstrdup(bg_conf->default_blrtsimage);
 
1020
        list_append(my_list, key_pair);
 
1021
 
 
1022
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1023
        key_pair->name = xstrdup("LinuxImage");
 
1024
        key_pair->value = xstrdup(bg_conf->default_linuximage);
 
1025
        list_append(my_list, key_pair);
 
1026
 
 
1027
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1028
        key_pair->name = xstrdup("RamDiskImage");
 
1029
        key_pair->value = xstrdup(bg_conf->default_ramdiskimage);
 
1030
        list_append(my_list, key_pair);
 
1031
#else
 
1032
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1033
        key_pair->name = xstrdup("CnloadImage");
 
1034
        key_pair->value = xstrdup(bg_conf->default_linuximage);
 
1035
        list_append(my_list, key_pair);
 
1036
 
 
1037
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1038
        key_pair->name = xstrdup("IoloadImage");
 
1039
        key_pair->value = xstrdup(bg_conf->default_ramdiskimage);
 
1040
        list_append(my_list, key_pair);
 
1041
#endif
 
1042
 
 
1043
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1044
        key_pair->name = xstrdup("BridgeAPILogFile");
 
1045
        key_pair->value = xstrdup(bg_conf->bridge_api_file);
 
1046
        list_append(my_list, key_pair);
 
1047
 
 
1048
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1049
        key_pair->name = xstrdup("BridgeAPIVerbose");
 
1050
        key_pair->value = xstrdup_printf("%u", bg_conf->bridge_api_verb);
 
1051
        list_append(my_list, key_pair);
 
1052
 
 
1053
        if(bg_conf->deny_pass) {
 
1054
                key_pair = xmalloc(sizeof(config_key_pair_t));
 
1055
                key_pair->name = xstrdup("DenyPassThrough");
 
1056
                if(bg_conf->deny_pass & PASS_DENY_X)
 
1057
                        xstrcat(key_pair->value, "X,");
 
1058
                if(bg_conf->deny_pass & PASS_DENY_Y)
 
1059
                        xstrcat(key_pair->value, "Y,");
 
1060
                if(bg_conf->deny_pass & PASS_DENY_Z)
 
1061
                        xstrcat(key_pair->value, "Z,");
 
1062
                if(key_pair->value)
 
1063
                        key_pair->value[strlen(key_pair->value)-1] = '\0';
 
1064
                list_append(my_list, key_pair);
 
1065
        }
 
1066
 
 
1067
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1068
        key_pair->name = xstrdup("LayoutMode");
 
1069
        switch(bg_conf->layout_mode) {
 
1070
        case LAYOUT_STATIC:
 
1071
                key_pair->value = xstrdup("Static");
 
1072
                break;
 
1073
        case LAYOUT_OVERLAP:
 
1074
                key_pair->value = xstrdup("Overlap");
 
1075
                break;
 
1076
        case LAYOUT_DYNAMIC:
 
1077
                key_pair->value = xstrdup("Dynamic");
 
1078
                break;
 
1079
        default:
 
1080
                key_pair->value = xstrdup("Unknown");
 
1081
                break;
 
1082
        }
 
1083
        list_append(my_list, key_pair);
 
1084
 
 
1085
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1086
        key_pair->name = xstrdup("MloaderImage");
 
1087
        key_pair->value = xstrdup(bg_conf->default_mloaderimage);
 
1088
        list_append(my_list, key_pair);
 
1089
 
 
1090
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1091
        key_pair->name = xstrdup("NodeCardNodeCnt");
 
1092
        key_pair->value = xstrdup_printf("%u", bg_conf->nodecard_node_cnt);
 
1093
        list_append(my_list, key_pair);
 
1094
 
 
1095
        key_pair = xmalloc(sizeof(config_key_pair_t));
 
1096
        key_pair->name = xstrdup("Numpsets");
 
1097
        key_pair->value = xstrdup_printf("%u", bg_conf->numpsets);
 
1098
        list_append(my_list, key_pair);
 
1099
 
 
1100
        list_sort(my_list, (ListCmpF) sort_key_pairs);
 
1101
 
 
1102
        return my_list;
1028
1103
}