diff --git a/auxdir/Makefile.am b/auxdir/Makefile.am index 889a52311796c9f887c492b870b7590f9b68d695..dd05b64986ac8f07ae118f127d9c53349b13e582 100644 --- a/auxdir/Makefile.am +++ b/auxdir/Makefile.am @@ -10,7 +10,7 @@ EXTRA_DIST = \ type_socklen_t.m4 \ x_ac__system_configuration.m4 \ x_ac_aix.m4 \ - x_ac_bgl.m4 \ + x_ac_bluegene.m4 \ x_ac_debug.m4 \ x_ac_elan.m4 \ x_ac_federation.m4 \ diff --git a/auxdir/x_ac_bgl.m4 b/auxdir/x_ac_bgl.m4 deleted file mode 100644 index f471e4ae937928fe9965681707b314852b837b4f..0000000000000000000000000000000000000000 --- a/auxdir/x_ac_bgl.m4 +++ /dev/null @@ -1,92 +0,0 @@ -##***************************************************************************** -## $Id$ -##***************************************************************************** -# AUTHOR: -# Morris Jette <jette1@llnl.gov> -# -# SYNOPSIS: -# X_AC_BGL -# -# DESCRIPTION: -# Test for Blue Gene/L specific files. If found define HAVE_BGL -##***************************************************************************** - - -AC_DEFUN([X_AC_BGL], -[ - AC_ARG_WITH(db2, - AC_HELP_STRING([--with-db2-dir=PATH], - [Specify path to DB2 library's parent directory]), - [ trydb2dir=$withval ] - ) - - bgl_default_dirs="/bgl/BlueLight/ppcfloor/bglsys /opt/IBM/db2/V8.1 /u/bgdb2cli/sqllib /home/bgdb2cli/sqllib" - - for bgl_dir in $trydb2dir "" $bgl_default_dirs; do - # Skip directories that don't exist - if test ! -z "$bgl_dir" -a ! -d "$bgl_dir" ; then - continue; - fi - - # Search for required BGL API libraries in the directory - if test -z "$have_bgl_ar" -a -f "$bgl_dir/lib/bglbootload.a" -a -f "$bgl_dir/lib/bglsp440supt.a" ; then - if test ! -f "$bgl_dir/lib64/libbglbridge_s.a" ; then - # Establish a link as required. Libtool requires the "lib" prefix - # to function properly. See - # "How to use --whole-archive arg with libtool" - # http://www.mail-archive.com/libtool@gnu.org/msg02792.html - AC_MSG_ERROR([$bgl_dir/lib64/libbglbridge_s.a is required and does not exist]) - fi - - have_bgl_ar=yes - bgl_ldflags="$bgl_ldflags -Wl,-rpath $bgl_dir/lib64 -Wl,-L$bgl_dir/lib64 -Wl,-whole-archive -Wl,-lbglbridge_s -Wl,-no-whole-archive $bgl_dir/lib/bglbootload.a $bgl_dir/lib/bglsp440supt.a -lsaymessage -lbgldb -lbglmachine -ltableapi -Wl,-rpath /usr/lib64 -L/usr/lib64 -lexpat" - - fi - - # Search for required DB2 library in the directory - if test -z "$have_db2" -a -f "$bgl_dir/lib64/libdb2.so" ; then - have_db2=yes - bgl_ldflags="$bgl_ldflags -Wl,-rpath $bgl_dir/lib64 -L$bgl_dir/lib64 -ldb2" - fi - - # Search for headers in the directory - if test -z "$have_bgl_hdr" -a -f "$bgl_dir/include/rm_api.h" ; then - have_bgl_hdr=yes - bgl_includes="-I$bgl_dir/include" - fi - done - - if test ! -z "$have_bgl_ar" -a ! -z "$have_bgl_hdr" -a ! -z "$have_db2" ; then - AC_DEFINE(HAVE_BGL, 1, [Define to 1 if emulating or running on Blue Gene system]) - AC_DEFINE(HAVE_FRONT_END, 1, [Define to 1 if running slurmd on front-end o -nly]) - ac_with_readline="no" - - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$saved_LDFLAGS $bgl_ldflags" - AC_TRY_LINK( - [ int rm_set_serial(char *); ], - [ rm_set_serial(""); ], - have_bgl_files=yes, []) - LDFLAGS="$saved_LDFLAGS" - fi - if test ! -z "$have_bgl_files" ; then - BGL_INCLUDES="$bgl_includes" - BGL_LDFLAGS="$bgl_ldflags" - AC_DEFINE(HAVE_BGL_FILES, 1, [Define to 1 if have Blue Gene files]) - - AC_MSG_CHECKING(for BGL serial value) - bgl_serial="BGL" - AC_ARG_WITH(bgl-serial, - AC_HELP_STRING([--with-bgl-serial=NAME], - [set bgl serial value [[BGL]]]), - [bgl_serial="$withval"] - ) - AC_MSG_RESULT($bgl_serial) - AC_DEFINE_UNQUOTED(BGL_SERIAL, "$bgl_serial", - [Define the BGL serial value]) - fi - - AC_SUBST(BGL_INCLUDES) - AC_SUBST(BGL_LDFLAGS) -]) diff --git a/auxdir/x_ac_bluegene.m4 b/auxdir/x_ac_bluegene.m4 new file mode 100644 index 0000000000000000000000000000000000000000..147eea40cf197483198c7984290453500aa0c9a3 --- /dev/null +++ b/auxdir/x_ac_bluegene.m4 @@ -0,0 +1,92 @@ +##***************************************************************************** +## $Id$ +##***************************************************************************** +# AUTHOR: +# Morris Jette <jette1@llnl.gov> +# +# SYNOPSIS: +# X_AC_BG +# +# DESCRIPTION: +# Test for Blue Gene/L specific files. If found define HAVE_BG +##***************************************************************************** + + +AC_DEFUN([X_AC_BLUEGENE], +[ + AC_ARG_WITH(db2, + AC_HELP_STRING([--with-db2-dir=PATH], + [Specify path to DB2 library's parent directory]), + [ trydb2dir=$withval ] + ) + + bg_default_dirs="/bgl/BlueLight/ppcfloor/bglsys /opt/IBM/db2/V8.1 /u/bgdb2cli/sqllib /home/bgdb2cli/sqllib" + + for bg_dir in $trydb2dir "" $bg_default_dirs; do + # Skip directories that don't exist + if test ! -z "$bg_dir" -a ! -d "$bg_dir" ; then + continue; + fi + + # Search for required BG API libraries in the directory + if test -z "$have_bg_ar" -a -f "$bg_dir/lib/bglbootload.a" -a -f "$bg_dir/lib/bglsp440supt.a" ; then + if test ! -f "$bg_dir/lib64/libbglbridge_s.a" ; then + # Establish a link as required. Libtool requires the "lib" prefix + # to function properly. See + # "How to use --whole-archive arg with libtool" + # http://www.mail-archive.com/libtool@gnu.org/msg02792.html + AC_MSG_ERROR([$bg_dir/lib64/libbglbridge_s.a is required and does not exist]) + fi + + have_bg_ar=yes + bg_ldflags="$bg_ldflags -Wl,-rpath $bg_dir/lib64 -Wl,-L$bg_dir/lib64 -Wl,-whole-archive -Wl,-lbglbridge_s -Wl,-no-whole-archive $bg_dir/lib/bglbootload.a $bg_dir/lib/bglsp440supt.a -lsaymessage -lbgldb -lbglmachine -ltableapi -Wl,-rpath /usr/lib64 -L/usr/lib64 -lexpat" + + fi + + # Search for required DB2 library in the directory + if test -z "$have_db2" -a -f "$bg_dir/lib64/libdb2.so" ; then + have_db2=yes + bg_ldflags="$bg_ldflags -Wl,-rpath $bg_dir/lib64 -L$bg_dir/lib64 -ldb2" + fi + + # Search for headers in the directory + if test -z "$have_bg_hdr" -a -f "$bg_dir/include/rm_api.h" ; then + have_bg_hdr=yes + bg_includes="-I$bg_dir/include" + fi + done + + if test ! -z "$have_bg_ar" -a ! -z "$have_bg_hdr" -a ! -z "$have_db2" ; then + AC_DEFINE(HAVE_BG, 1, [Define to 1 if emulating or running on Blue Gene system]) + AC_DEFINE(HAVE_FRONT_END, 1, [Define to 1 if running slurmd on front-end o +nly]) + ac_with_readline="no" + + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$saved_LDFLAGS $bg_ldflags" + AC_TRY_LINK( + [ int rm_set_serial(char *); ], + [ rm_set_serial(""); ], + have_bg_files=yes, []) + LDFLAGS="$saved_LDFLAGS" + fi + if test ! -z "$have_bg_files" ; then + BG_INCLUDES="$bg_includes" + BG_LDFLAGS="$bg_ldflags" + AC_DEFINE(HAVE_BG_FILES, 1, [Define to 1 if have Blue Gene files]) + + AC_MSG_CHECKING(for BG serial value) + bg_serial="BGL" + AC_ARG_WITH(bg-serial, + AC_HELP_STRING([--with-bg-serial=NAME], + [set BG_SERIAL value [[BGL]]]), + [bg_serial="$withval"] + ) + AC_MSG_RESULT($bg_serial) + AC_DEFINE_UNQUOTED(BG_SERIAL, "$bg_serial", + [Define the BG_SERIAL value]) + fi + + AC_SUBST(BG_INCLUDES) + AC_SUBST(BG_LDFLAGS) +]) diff --git a/configure.ac b/configure.ac index 248bd92ac10fb60bbcfc2420bf02395a5e928aff..0dfbe96b17298348c0cc3a704650be869557ab46 100644 --- a/configure.ac +++ b/configure.ac @@ -100,7 +100,7 @@ LDFLAGS="$LDFLAGS " CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" -X_AC_BGL +X_AC_BLUEGENE X_AC_SLURM_SEMAPHORE X_AC_NCURSES @@ -197,7 +197,6 @@ AC_CONFIG_FILES([Makefile src/squeue/Makefile src/sinfo/Makefile src/smap/Makefile - src/partition_allocator/Makefile src/plugins/Makefile src/plugins/auth/Makefile src/plugins/auth/authd/Makefile @@ -226,6 +225,8 @@ AC_CONFIG_FILES([Makefile src/plugins/sched/maui/wiki/Makefile src/plugins/select/Makefile src/plugins/select/bluegene/Makefile + src/plugins/select/bluegene/block_allocator/Makefile + src/plugins/select/bluegene/plugin/Makefile src/plugins/select/linear/Makefile src/plugins/select/cons_res/Makefile src/plugins/switch/Makefile diff --git a/doc/html/bluegene.html b/doc/html/bluegene.html index 2830f96513ea0311b07a5ee72b5c829f769a1592..141fd309c10c53ac0b5c37c9f7f6aec4e6daffdc 100644 --- a/doc/html/bluegene.html +++ b/doc/html/bluegene.html @@ -103,12 +103,12 @@ therefore it is recommended that batch jobs explicitly specify unique names for stdout and stderr files using the srun options <i>--output</i> and <i>--error</i> respectively. While the srun <i>--allocate</i> option may be used to create an interactive SLURM job, -it will be the responsibility of the user to insure that the <i>bglblock</i> +it will be the responsibility of the user to insure that the <i>bgblock</i> is ready for use before initiating any mpirun commands. SLURM will assume this responsibility for batch jobs. The script that you submit to SLURM can contain multiple invocations of mpirun as well as any desired commands for pre- and post-processing. -The mpirun command will get its <i>bglblock</i> or BGL partition information from the +The mpirun command will get its <i>bgblock</i> or BG block information from the <i>MPIRUN_PARTITION</i> as set by SLURM. A sample script is shown below. <pre> #!/bin/bash @@ -124,13 +124,13 @@ date <a name="naming"> <p>The naming of nodes includes a three-digit suffix representing the base partition's location in the X, Y and Z dimensions with a zero origin. -For example, "bgl012" represents the base partition whose location is at X=0, Y=1 and Z=2. +For example, "bg012" represents the base partition whose location is at X=0, Y=1 and Z=2. Since jobs must be allocated consecutive nodes in all three dimensions, we have developed an abbreviated format for describing the nodes in one of these three-dimensional blocks. -The node's prefix of "bgl" is followed by the end-points of the block enclosed in square-brackets. -For example, " bgl[620x731]" is used to represent the eight nodes enclosed in a block -with endpoints bgl620 and bgl731 (bgl620, bgl621, bgl630, bgl631, bgl720, bgl721, -bgl730 and bgl731).</p></a> +The node's prefix of "bg" is followed by the end-points of the block enclosed in square-brackets. +For example, " bg[620x731]" is used to represent the eight nodes enclosed in a block +with endpoints bg620 and bg731 (bg620, bg621, bg630, bg631, bg720, bg721, +bg730 and bg731).</p></a> <p>One new tool provided is <i>smap</i>. Smap is aware of system topography and provides a map of what nodes are allocated @@ -140,7 +140,7 @@ A sample of smap output is provided below showing the location of five jobs. Note the format of the list of nodes allocated to each job. Also note that idle (unassigned) base partitions are indicated by a period. Down and drained base partitions (those not available for use) are -indicated by a number sign (bgl703 in the display below). +indicated by a number sign (bg703 in the display below). The legend is for illustrative purposes only. The origin (zero in every dimension) is shown at the rear left corner of the bottom plane. Each set of four consecutive lines represents a plane in the Y dimension. @@ -148,12 +148,12 @@ Values in the X dimension increase to the right. Values in the Z dimension increase down and toward the left.</p> <pre> - a a a a b b d d ID JOBID PARTITION USER NAME ST TIME NODES NODELIST - a a a a b b d d a 12345 batch joseph tst1 R 43:12 64 bgl[000x333] - a a a a b b c c b 12346 debug chris sim3 R 12:34 16 bgl[420x533] -a a a a b b c c c 12350 debug danny job3 R 0:12 8 bgl[622x733] - d 12356 debug dan colu R 18:05 16 bgl[600x731] - a a a a b b d d e 12378 debug joseph asx4 R 0:34 4 bgl[612x713] + a a a a b b d d ID JOBID PARTITION BGL_BLOCK USER NAME ST TIME NODES NODELIST + a a a a b b d d a 12345 batch RMP0 joseph tst1 R 43:12 64 bg[000x333] + a a a a b b c c b 12346 debug RMP1 chris sim3 R 12:34 16 bg[420x533] +a a a a b b c c c 12350 debug RMP2 danny job3 R 0:12 8 bg[622x733] + d 12356 debug RMP3 dan colu R 18:05 16 bg[600x731] + a a a a b b d d e 12378 debug RMP4 joseph asx4 R 0:34 4 bg[612x713] a a a a b b d d a a a a b b c c a a a a b b c c @@ -170,30 +170,30 @@ a a a a . . . # Z </pre> <p>Note that jobs enter the SLURM state RUNNING as soon as the have been -allocated a bglblock. -If the bglblock is in a READY state, the job will begin execution almost +allocated a bgblock. +If the bgblock is in a READY state, the job will begin execution almost immediately. Otherwise the execution of the job will not actually begin until the -bglblock is in a READY state, which can require booting the block and +bgblock is in a READY state, which can require booting the block and a delay of minutes to do so. -You can identify the bglblock associated with your job using the command -<i>smap -Dj -c</i> and the state of the bglblock with the command +You can identify the bgblock associated with your job using the command +<i>smap -Dj -c</i> and the state of the bgblock with the command <i>smap -Db -c</i>. -The time to boot a bglblock is related to its size, but should range from -from a few minutes to about 15 minutes for a bglblock containing 64 +The time to boot a bgblock is related to its size, but should range from +from a few minutes to about 15 minutes for a bgblock containing 64 base partitions. -Only after the bglblock is READY will your job's output file be created +Only after the bgblock is READY will your job's output file be created and the script execution begin. -If the bglblock boot fails, SLURM will attempt to reboot several times +If the bgblock boot fails, SLURM will attempt to reboot several times before draining the associated nodes and aborting the job.</p> -<p>The job will continue to be in a RUNNING state until the bgljob has -completed and the bglblock ownership is changed. -The time for completing a bgljob has freqently been on the order of +<p>The job will continue to be in a RUNNING state until the bgjob has +completed and the bgblock ownership is changed. +The time for completing a bgjob has freqently been on the order of five minutes. In summary, your job may appear in SLURM as RUNNING for 15 minutes before the script actually begins to 5 minutes after it completes. -These delays are the result of BGL infrastructure issues and are +These delays are the result of BG infrastructure issues and are not due to anything in SLURM.</p> <p>When using smap in curses mode you can scroll through the different windows @@ -219,7 +219,7 @@ Service Node (SN) and the Front End Nodes (FEN) then you can configure and build one set of files on the SN and install them on both the SN and FEN. Note that if your FENs lack an installed <i>libdb2.so</i>, an smap built on the SN will be unable to execute at all on those nodes (it -calls BGL Bridge APIs, that dynamically load <i>libdb2.so</i> completely +calls BG Bridge APIs, that dynamically load <i>libdb2.so</i> completely out of our control). You can handle this in two different ways. One option is to build two versions of smap (in the main SLURM RPM), @@ -227,7 +227,7 @@ one for the SN and the other for the FENs. The second option is to create a dummy <i>libdb2.so</i> on the FENs (it can just point to libslurm.so) so that smap can be initiated. Smap will discover if <i>libdb2.so</i> is invalid and avoid using -any BGL Bridge function calls, which would fail. +any BG Bridge function calls, which would fail. In either case, all smap functionality will be provided on the FEN except for the ability to map SLURM node names to and from row/rack/midplane data.</p> @@ -235,17 +235,17 @@ row/rack/midplane data.</p> <p>If you have different versions of the operating system on the SN and FEN (as was the case for some early system installations), then you will need to configure and build two sets of files for installation. -One set will be for the Service Node (SN), which has direct access to the BGL Bridge APIs. +One set will be for the Service Node (SN), which has direct access to the BG Bridge APIs. The second set will be for the Front End Nodes (FEN), whick lack access to the Bridge APIs and interact with using Remote Proceedure Calls to the slurmctld daemon. -You should see "#define HAVE_BGL 1" and "#define HAVE_FRONT_END 1" in the "config.h" +You should see "#define HAVE_BG 1" and "#define HAVE_FRONT_END 1" in the "config.h" file for both the SN and FEN builds. -You should also see "#define HAVE_BGL_FILES 1" in config.h on the SN before +You should also see "#define HAVE_BG_FILES 1" in config.h on the SN before building SLURM. </p> <p>The slurmctld daemon should execute on the system's service node. If an optional backup daemon is used, it must be in some location where -it is capable of executing BGL Bridge APIs. +it is capable of executing BG Bridge APIs. One slurmd daemon should be configured to execute on one of the front end nodes. That one slurmd daemon represents communications channel for every base partition. A future release of SLURM will support multiple slurmd daemons on multiple @@ -261,11 +261,11 @@ node selection performed using a system aware of the system's topography and interfaces. The value of <i>SchedulerType</i> should be set to "sched/builtin". The value of <i>Prolog</i> should be set to the full pathname of a program that -will delay execution until the bglblock identified by the MPIRUN_PARTITION +will delay execution until the bgblock identified by the MPIRUN_PARTITION environment variable is ready for use. It is recommended that you construct a script that serves this function and calls the supplied program <i>sbin/slurm_prolog</i>. The value of <i>Epilog</i> should be set to the full pathname of a program that -will wait until the bglblock identified by the MPIRUN_PARTITION environment +will wait until the bgblock identified by the MPIRUN_PARTITION environment variable is no longer usable by this job. It is recommended that you construct a script that serves this function and calls the supplied program <i>sbin/slurm_epilog</i>. The prolog and epilog programs are used to insure proper synchronization @@ -278,7 +278,7 @@ etc.). Sample prolog and epilog scripts follow. </p> #!/bin/bash # Sample Blue Gene Prolog script # -# Wait for bglblock to be ready for this job's use +# Wait for bgblock to be ready for this job's use /usr/sbin/slurm_prolog @@ -286,10 +286,10 @@ etc.). Sample prolog and epilog scripts follow. </p> # Sample Blue Gene Epilog script # # Cancel job to start the termination process for this job -# and release the bglblock +# and release the bgblock /usr/bin/scancel $SLURM_JOBID # -# Wait for bglblock to be released from this job's use +# Wait for bgblock to be released from this job's use /usr/sbin/slurm_epilog </pre> @@ -311,12 +311,15 @@ the scontrol reconfig command. </p> <p>SLURM node and partition descriptions should make use of the <a href="#naming">naming</a> conventions described above. For example, -"NodeName=bgl[000x733] NodeAddr=frontend0 NodeHostname=frontend0 Procs=1024". +"NodeName=bg[000x733] NodeAddr=frontend0 NodeHostname=frontend0 Procs=1024". +Based on the prefix you give to the noderange in the NodeName= variable +the bgl blocks will be named by such. Thus this can be anything you want, but +needs to be consitant throughout the slurm.conf file. Note that the values of both NodeAddr and NodeHostname for all 128 base partitions is the name of the front end node executing the slurmd daemon. The NodeName values represent base partitions. -No computers are actually expected to return a value of "bgl000" +No computers are actually expected to return a value of "bg000" in response to the <i>hostname</i> command nor will any attempt be made to route message traffic to this address. </p> @@ -331,14 +334,14 @@ It is best to minimize other work on the front end node executing slurmd so as to maximize its performance and minimize other risk factors.</p> <p>Presently the system administrator must explicitly define each of the -Blue Gene partitions (or bglblocks) available to execute jobs. +Blue Gene partitions (or bgblocks) available to execute jobs. (<b>NOTE:</b> Blue Gene partitions are unrelated to SLURM partitions.) -Jobs must then execute in one of these pre-defined bglblocks. +Jobs must then execute in one of these pre-defined bgblocks. This is known as <i>static partitioning</i>. -Each of these bglblocks are explicitly configured with either a mesh or +Each of these bgblocks are explicitly configured with either a mesh or torus interconnect. They must also not overlap, except for the implicitly defined full-system -bglblock. +bgblock. In addition to the normal <i>slurm.conf</i> file, a new <i>bluegene.conf</i> configuration file is required with this information. Put <i>bluegene.conf</i> into the SLURM configuration directory with @@ -348,24 +351,24 @@ System administrators should use the <i>smap</i> tool to build appropriate configuration file for static partitioning. Note that <i>smap -Dc</i> can be run without the SLURM daemons active to establish the initial configuration. -Note that the defined bglblocks may not overlap (except for the -full-system bglblock, which is implicitly created). +Note that the defined bgblocks may not overlap (except for the +full-system bgblock, which is implicitly created). See the smap man page for more information. You must insure that the nodes defined in <i>bluegene.conf</i> are consistent with those defined in <i>slurm.conf</i>. Note that the Image and Numpsets values defined in <i>bluegene.conf</i> -are used only when SLURM creates bglblocks. -If previously defined bglblocks are used by SLURM, their configurations +are used only when SLURM creates bgblocks. +If previously defined bgblocks are used by SLURM, their configurations are not altered. -If you change the bglblock layout, then slurmctld and slurmd should +If you change the bgblock layout, then slurmctld and slurmd should both be cold-started (e.g. <b>/etc/init.d/slurm startclean</b>). If you which to modify the Image and Numpsets values for existing -bglblocks, either modify them manually or destroy the bglblocks +bgblocks, either modify them manually or destroy the bgblocks and let SLURM recreate them. -Note that in addition to the bglblocks defined in blugene.conf, an -additional bglblock is created containing all resources defined -all of the other defined bglblocks. -If you modify the bglblocks, it is recommended that you restart +Note that in addition to the bgblocks defined in blugene.conf, an +additional bgblock is created containing all resources defined +all of the other defined bgblocks. +If you modify the bgblocks, it is recommended that you restart both slurmctld and slurmd without preserving state (<i>/etc/init.d/slurm startclean</i>). Note that SLURM wiring decisions are based upon the link-cards @@ -374,30 +377,30 @@ If your BlueGene system is wired in an unconventional fashion, modifications to the file <i>src/partition_allocator/partition_allocator.c</i> may be required. Make use of the SLURM partition mechanism to control access to these -bglblocks. A sample <i>bluegene.conf</i> file is shown below. +bgblocks. A sample <i>bluegene.conf</i> file is shown below. <pre> ############################################################################### # Global specifications for Blue Gene system # -# BlrtsImage: BlrtsImage used for creation of all bglblocks. -# LinuxImage: LinuxImage used for creation of all bglblocks. -# MloaderImage: MloaderImage used for creation of all bglblocks. -# RamDiskImage: RamDiskImage used for creation of all bglblocks. -# Numpsets: The Numpsets used for creation of all bglblocks +# BlrtsImage: BlrtsImage used for creation of all bgblocks. +# LinuxImage: LinuxImage used for creation of all bgblocks. +# MloaderImage: MloaderImage used for creation of all bgblocks. +# RamDiskImage: RamDiskImage used for creation of all bgblocks. +# Numpsets: The Numpsets used for creation of all bgblocks # equals this value multiplied by the number of -# base partitions in the bglblock. +# base partitions in the bgblock. # -# BridgeAPILogFile : Pathname of file in which to write the BGL +# BridgeAPILogFile : Pathname of file in which to write the BG # Bridge API logs. -# BridgeAPIVerbose: How verbose the BGL Bridge API logs should be +# BridgeAPIVerbose: How verbose the BG Bridge API logs should be # 0: Log only error and warning messages # 1: Log level 0 and information messasges # 2: Log level 1 and basic debug messages # 3: Log level 2 and more debug message # 4: Log all messages # -# NOTE: The bgl_serial value is set at configuration time using the -# "--with-bgl-serial=" option. Its default value is "BGL". +# NOTE: The bg_serial value is set at configuration time using the +# "--with-bg-serial=" option. Its default value is "BGL". ############################################################################### BlrtsImage=/bgl/BlueLight/ppcfloor/bglsys/bin/rts_hw.rts LinuxImage=/bgl/BlueLight/ppcfloor/bglsys/bin/zImage.elf @@ -409,40 +412,43 @@ BridgeAPILogFile=/var/log/slurm/bridgeapi.log BridgeAPIVerbose=0 ############################################################################### -# Define the static partitions (bglblocks) +# Define the static partitions (bgblocks) # -# Nodes: The base partitions (midplanes) in the bglblock using XYZ coordinates +# Nodes: The base partitions (midplanes) in the bgblock using XYZ coordinates # Type: Connection type "MESH" or "TORUS" or "SMALL", default is "TORUS" -# Type SMALL will divide a midplane into multiple bglblocks -# 4 bglblocks each containing 128 c-nodes -# (smaller bglblocks are presently not supported) +# Type SMALL will divide a midplane into multiple bgblocks +# 4 bgblocks each containing 128 c-nodes +# (smaller bgblocks are presently not supported) # # IMPORTANT NOTES: -# * A bglblock is implicitly created containing all resources on the system -# * Bglblocks must not overlap (except for implicitly created bglblock) +# * Ordering is very important for laying out switch wires. Please create +# blocks with smap, and once done don't move the order of blocks +# created. +# * A bgblock is implicitly created containing all resources on the system +# * Bgblocks must not overlap (except for implicitly created bgblock) # This will be the case when smap is used to create a configuration file # * All Nodes defined here must also be defined in the slurm.conf file ############################################################################### -# LEAVE NEXT LINE AS A COMMENT, Full-system bglblock, implicitly created -# Nodes=bgl[000x001] Type=TORUS # 1x1x2 = 2 midplanes +# LEAVE NEXT LINE AS A COMMENT, Full-system bgblock, implicitly created +# Nodes=[000x001] Type=TORUS # 1x1x2 = 2 midplanes ############################################################################### # volume = 1x1x1 = 1 -Nodes=bgl[000x000] Type=TORUS # 1x1x1 = 1 midplane -Nodes=bgl[001x001] Type=SMALL # 1x1x1 = 1 midplane, in four bglblocks +Nodes=[000x000] Type=TORUS # 1x1x1 = 1 midplane +Nodes=[001x001] Type=SMALL # 1x1x1 = 1 midplane, in four bgblocks </pre></p> -<p>The above <i>bluegene.conf</i> file defines multiple bglblocks to be +<p>The above <i>bluegene.conf</i> file defines multiple bgblocks to be created in a single midplane (see the "SMALL" option). -Note that you can not presently control how many bglblocks are created +Note that you can not presently control how many bgblocks are created in a midplane, it will be four. Using this mechanism, up to eight independent jobs can be executed simultaneously on a one-rack Blue Gene system. -If defining bglblocks of <i>Type=SMALL</i>, the SLURM partition +If defining bgblocks of <i>Type=SMALL</i>, the SLURM partition containing them as defined in <i>slurm.conf</i> must have the parameter <i>Shared=force</i> to enable scheduling of multiple jobs on what SLURM considers a single node. -SLURM partitions that do not contain bglblocks of <i>Type=SMALL</i> +SLURM partitions that do not contain bgblocks of <i>Type=SMALL</i> may have the parameter <i>Shared=no</i> for a slight improvement in scheduler performance. As in all SLURM configuration files, parameters and values @@ -469,32 +475,32 @@ At that time the <i>bluegene.conf</i> configuration file will become obsolete. Dynamic partition does involve substantial overhead including the rebooting of c-nodes and I/O nodes.</p> -<p>When slurmctld is initially started on an idle system, the bglblocks -already defined in MMCS are read using the BGL Bridge APIs. -If these bglblocks do not correspond to those defined in the bluegene.conf -file, the old bglblocks with a prefix of "RMP" are destroyed and new ones +<p>When slurmctld is initially started on an idle system, the bgblocks +already defined in MMCS are read using the BG Bridge APIs. +If these bgblocks do not correspond to those defined in the bluegene.conf +file, the old bgblocks with a prefix of "RMP" are destroyed and new ones created. -When a job is scheduled, the appropriate bglblock is identified, +When a job is scheduled, the appropriate bgblock is identified, its user set, and it is booted. Node use (virtual or coprocessor) is set from the mpirun command line now, Slurm has nothing to do with setting the node use. -Subsequent jobs use this same bglblock without rebooting by changing +Subsequent jobs use this same bgblock without rebooting by changing the associated user field. -The only time bglblocks should be freed and rebooted, in normal operation, +The only time bgblocks should be freed and rebooted, in normal operation, is when going to or from full-system -jobs (two or more bglblocks sharing base partitions can not be in a +jobs (two or more bgblocks sharing base partitions can not be in a ready state at the same time). When this logic became available at LLNL, approximately 85 percent of -bglblock boots were eliminated and the overhead of job startup went +bgblock boots were eliminated and the overhead of job startup went from about 24% to about 6% of total job time. -Note that bglblocks will remain in a ready (booted) state when +Note that bgblocks will remain in a ready (booted) state when the SLURM daemons are stopped. This permits SLURM daemon restarts without loss of running jobs -or rebooting of bglblocks. </p> +or rebooting of bgblocks. </p> -<p>Be aware that SLURM will issue multiple bglblock boot requests as +<p>Be aware that SLURM will issue multiple bgblock boot requests as needed (e.g. when the boot fails). -If the bglblock boot requests repeatedly fail, SLURM will configure +If the bgblock boot requests repeatedly fail, SLURM will configure the failing nodes to a DRAINED state so as to avoid continuing repeated reboots and the likely failure of user jobs. A system administrator should address the problem before returning @@ -504,10 +510,10 @@ the nodes to service.</p> or <b>slurmctld -c</b>) it is recommended that you also cold-start the slurmd at the same time. Failure to do so may result in errors being reported by both slurmd -and slurmctld due to bglblocks that previously existed being deleted.</p> +and slurmctld due to bgblocks that previously existed being deleted.</p> -<p>A new tool <b>sfree</b> has also been added to help admins free a BGL -partition on request. +<p>A new tool <b>sfree</b> has also been added to help admins free a BG +block on request. <br>For usage use <b>sfree -u</b> and for help <b>-h</b>.</p> <h4>Debugging</h4> @@ -524,7 +530,7 @@ in <b>bluegene.conf</b> which can be configured to contain detailed information about every Bridge API call issued.</p> <p>Note that slurmcltld log messages of the sort -<i>Nodes bgl[000x133] not responding</i> are indicative of the slurmd +<i>Nodes bg[000x133] not responding</i> are indicative of the slurmd daemon serving as a front-end to those nodes is not responding (on non-Blue Gene systems, the slurmd actaully does run on the compute nodes, so the message is more meaningful there). </p> diff --git a/doc/man/man1/smap.1 b/doc/man/man1/smap.1 index e9fcd74991e4322a34b16f7dfd307b6dab39db8f..4c9ccd7d1bf9ee009c5af60132276dfd773332fd 100644 --- a/doc/man/man1/smap.1 +++ b/doc/man/man1/smap.1 @@ -220,6 +220,11 @@ and their values are case insensitive (e.g. "MESH" and "mesh" are equivalent). .RS .TP 10 +.I \fBStart = XxYxZ\fR +Identify where to start the partition. This is primarily for testing +purposes. For convenience one can only put the X coord or XxY will also work. +The default value is 0x0x0. +.TP .I \fBConnection = MESH | TORUS | SMALL\fR Identify how the nodes should be connected in network. The default value is TORUS. @@ -264,12 +269,22 @@ By default, one copy is made. .TP .I \fBdelete <id>\fR -Delete the specified block or (default) the last partition created. +Delete the specified block. .TP .I \fBdown <node_range>\fR Down a specific node or range of nodes. i.e. 000, 000\-111 [000x111] +.TP +.I \fBup <node_range>\fR +Bring a specific node or range of nodes up. +i.e. 000, 000\-111 [000x111] +.TP +.I \fBalldown\fR +Set all nodes to down state. +.TP +.I \fBallup\fR +Set all nodes to up state. .TP .I \fBsave <file_name>\fR diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in index 1d44bda68da3d93f96173f72b76292190fb8c360..d601fd49c02893a8c8e6c7ac1eb2ecd17bef1f1c 100644 --- a/slurm/slurm.h.in +++ b/slurm/slurm.h.in @@ -54,7 +54,7 @@ #endif /* Define to 1 if you have Blue Gene system support. */ -#undef HAVE_BGL +#undef HAVE_BG /* Define to 1 if you have the `elan3' library (-lelan3). */ #undef HAVE_ELAN @@ -162,7 +162,7 @@ enum job_wait_reason { WAIT_TIME /* job waiting for specific begin time */ }; -#ifdef HAVE_BGL +#ifdef HAVE_BG # define SYSTEM_DIMENSIONS 3 /* for job geometry */ #else # define SYSTEM_DIMENSIONS 0 /* for job geometry */ @@ -186,7 +186,7 @@ enum select_data_type { SELECT_DATA_ROTATE, /* data-> uint16_t rotate */ SELECT_DATA_NODE_USE, /* data-> uint16_t node_use */ SELECT_DATA_CONN_TYPE, /* data-> uint16_t connection_type */ - SELECT_DATA_PART_ID, /* data-> char bgl_part_id */ + SELECT_DATA_BLOCK_ID, /* data-> char bg_block_id */ SELECT_DATA_CHECKED /* data-> uint16_t checked */ }; @@ -194,7 +194,7 @@ enum select_print_mode { SELECT_PRINT_HEAD, /* Print just the header */ SELECT_PRINT_DATA, /* Print just the data */ SELECT_PRINT_MIXED, /* Print "field=value" */ - SELECT_PRINT_BGL_ID /* Print just the BGL_ID */ + SELECT_PRINT_BG_ID /* Print just the BG_ID */ }; /* Possible task distributions across the nodes */ diff --git a/src/Makefile.am b/src/Makefile.am index 9a568ddd80f38c58c3fd539581b8aed85ec0d2f4..91239446a2a61274c81e33dfa0177f8a11d0e540 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,3 @@ # $Id$ -SUBDIRS = common api slurmctld slurmd srun sacct scontrol scancel squeue sinfo partition_allocator smap plugins +SUBDIRS = common api slurmctld slurmd plugins srun sacct scontrol scancel squeue sinfo smap diff --git a/src/api/allocate.c b/src/api/allocate.c index 2b69a45db9bac1a6b655bac2a705c80787178df3..fc70831d22df04486f0aebe18d361abd9db1405f 100644 --- a/src/api/allocate.c +++ b/src/api/allocate.c @@ -39,6 +39,7 @@ extern pid_t getsid(pid_t pid); /* missing from <unistd.h> */ #endif #include <slurm/slurm.h> +#include <stdlib.h> #include "src/common/read_config.h" #include "src/common/slurm_protocol_api.h" @@ -305,7 +306,7 @@ static int _nodelist_from_hostfile(job_step_create_request_msg_t *req) int line_num = 0; char *nodelist = NULL; - if (hostfile = (char *)getenv("MP_HOSTFILE")) { + if (hostfile = getenv("MP_HOSTFILE")) { if(strlen(hostfile)<1 || !strcmp(hostfile,"NULL")) goto no_hostfile; if((hostfilep = fopen(hostfile, "r")) == NULL) { diff --git a/src/api/node_select_info.h b/src/api/node_select_info.h index dd4a22546ceb7b97935cf7cb61ecd30b1a481c6d..7120924153000267dcb041433ae1a47282c79b4c 100644 --- a/src/api/node_select_info.h +++ b/src/api/node_select_info.h @@ -39,17 +39,17 @@ typedef struct { char *nodes; char *owner_name; - char *bgl_part_id; + char *bg_block_id; int state; int conn_type; int node_use; int quarter; -} bgl_info_record_t; +} bg_info_record_t; typedef struct { time_t last_update; uint32_t record_count; - bgl_info_record_t *bgl_info_array; + bg_info_record_t *bg_info_array; } node_select_info_msg_t; /* diff --git a/src/common/env.c b/src/common/env.c index 1be660333e52a40f83490130c8994eb1b1e8f123..ea18139fa19890038ecc54097b3e2268a547a319 100644 --- a/src/common/env.c +++ b/src/common/env.c @@ -280,7 +280,7 @@ int setup_env(env_t *env) if(env->select_jobinfo) { select_g_get_jobinfo(env->select_jobinfo, - SELECT_DATA_PART_ID, &bgl_part_id); + SELECT_DATA_BLOCK_ID, &bgl_part_id); if (bgl_part_id) { if(setenvf(&env->env, "MPIRUN_PARTITION", "%s", bgl_part_id)) diff --git a/src/common/hostlist.c b/src/common/hostlist.c index 663ce858e9f1dc6bd76465a0511bf92bb9f46e10..b25ab119b7484fe4f582dace547f5b60a7b4a6ad 100644 --- a/src/common/hostlist.c +++ b/src/common/hostlist.c @@ -158,7 +158,7 @@ strong_alias(hostset_within, slurm_hostset_within); /* ----[ Internal Data Structures ]---- */ -#ifdef HAVE_BGL +#ifdef HAVE_BG /* logic for block node description */ /* We allocate space for three digits, * each with values 0 to 9 even if they are not all used */ @@ -2186,7 +2186,7 @@ _get_bracketed_list(hostlist_t hl, int *start, const size_t n, char *buf) return len; } -#ifdef HAVE_BGL +#ifdef HAVE_BG /* logic for block node description */ /* write the next bracketed hostlist, i.e. prefix[n-m,k,...] @@ -2334,7 +2334,7 @@ size_t hostlist_ranged_string(hostlist_t hl, size_t n, char *buf) LOCK_HOSTLIST(hl); -#ifdef HAVE_BGL /* logic for block node description */ +#ifdef HAVE_BG /* logic for block node description */ if (hl->nranges < 1) goto notbox; /* no data */ if (hl->hr[0]->width != 3) @@ -2864,9 +2864,9 @@ int main(int ac, char **av) printf("after delete = `%s'\n", buf); hostlist_destroy(hl3); - hl3 = hostlist_create("bgl[012x123]"); + hl3 = hostlist_create("bg[012x123]"); hostlist_ranged_string(hl3, 102400, buf); - printf("bgl[012x123] == `%s'\n", buf); + printf("bg[012x123] == `%s'\n", buf); i = hostlist_count(hl3); assert(i == 8); hostlist_ranged_string(hl3, 102400, buf); diff --git a/src/common/node_select.c b/src/common/node_select.c index 5e20aac53473105523248dc9ef52ba4a21258a4c..7932f325f39c50d8e5ef95de687aa86ad3b24181 100644 --- a/src/common/node_select.c +++ b/src/common/node_select.c @@ -97,7 +97,7 @@ static slurm_select_context_t * g_select_context = NULL; static pthread_mutex_t g_select_context_lock = PTHREAD_MUTEX_INITIALIZER; -#ifdef HAVE_BGL /* node selection specific logic */ +#ifdef HAVE_BG /* node selection specific logic */ # define JOBINFO_MAGIC 0x83ac struct select_jobinfo { uint16_t geometry[SYSTEM_DIMENSIONS]; /* node count in various @@ -105,9 +105,9 @@ struct select_jobinfo { uint16_t conn_type; /* see enum connection_type */ uint16_t rotate; /* permit geometry rotation if set */ uint16_t node_use; /* see enum node_use_type */ - char *bgl_part_id; /* Blue Gene partition ID */ + char *bg_block_id; /* Blue Gene partition ID */ uint16_t magic; /* magic number */ - uint32_t checked; /* for bgl to tell plugin it already + uint32_t checked; /* for bg to tell plugin it already checked and all partitions were full looking for best choice now */ @@ -134,7 +134,7 @@ static slurm_select_ops_t * _select_get_ops(slurm_select_context_t *c) "select_p_state_restore", "select_p_job_init", "select_p_node_init", - "select_p_part_init", + "select_p_block_init", "select_p_job_test", "select_p_job_begin", "select_p_job_ready", @@ -327,7 +327,7 @@ extern int select_g_node_init(struct node_record *node_ptr, int node_cnt) * Note re/initialization of partition record data structure * IN part_list - list of partition records */ -extern int select_g_part_init(List part_list) +extern int select_g_block_init(List part_list) { if (slurm_select_init() < 0) return SLURM_ERROR; @@ -461,7 +461,7 @@ extern int select_g_pack_node_info(time_t last_query_time, Buf *buffer) (last_query_time, buffer); } -#ifdef HAVE_BGL /* node selection specific logic */ +#ifdef HAVE_BG /* node selection specific logic */ static char *_job_conn_type_string(uint16_t inx) { if (inx == SELECT_TORUS) @@ -525,10 +525,10 @@ extern int select_g_set_jobinfo (select_jobinfo_t jobinfo, case SELECT_DATA_CONN_TYPE: jobinfo->conn_type = *tmp_16; break; - case SELECT_DATA_PART_ID: + case SELECT_DATA_BLOCK_ID: /* we xfree() any preset value to avoid a memory leak */ - xfree(jobinfo->bgl_part_id); - jobinfo->bgl_part_id = xstrdup(tmp_char); + xfree(jobinfo->bg_block_id); + jobinfo->bg_block_id = xstrdup(tmp_char); break; case SELECT_DATA_CHECKED: jobinfo->checked = *tmp_16; @@ -545,7 +545,7 @@ extern int select_g_set_jobinfo (select_jobinfo_t jobinfo, * IN jobinfo - updated select job credential * IN data_type - type of data to enter into job credential * OUT data - the data to get from job credential, caller must xfree - * data for data_tyep == SELECT_DATA_PART_ID + * data for data_tyep == SELECT_DATA_BLOCK_ID */ extern int select_g_get_jobinfo (select_jobinfo_t jobinfo, enum select_data_type data_type, void *data) @@ -573,12 +573,12 @@ extern int select_g_get_jobinfo (select_jobinfo_t jobinfo, case SELECT_DATA_CONN_TYPE: *tmp_16 = jobinfo->conn_type; break; - case SELECT_DATA_PART_ID: - if ((jobinfo->bgl_part_id == NULL) - || (jobinfo->bgl_part_id[0] == '\0')) + case SELECT_DATA_BLOCK_ID: + if ((jobinfo->bg_block_id == NULL) + || (jobinfo->bg_block_id[0] == '\0')) *tmp_char = NULL; else - *tmp_char = xstrdup(jobinfo->bgl_part_id); + *tmp_char = xstrdup(jobinfo->bg_block_id); break; case SELECT_DATA_CHECKED: *tmp_16 = jobinfo->checked; @@ -613,7 +613,7 @@ extern select_jobinfo_t select_g_copy_jobinfo(select_jobinfo_t jobinfo) rc->rotate = jobinfo->rotate; rc->conn_type = jobinfo->conn_type; rc->rotate = jobinfo->rotate; - rc->bgl_part_id = xstrdup(jobinfo->bgl_part_id); + rc->bg_block_id = xstrdup(jobinfo->bg_block_id); } return rc; @@ -634,7 +634,7 @@ extern int select_g_free_jobinfo (select_jobinfo_t *jobinfo) rc = EINVAL; } else { (*jobinfo)->magic = 0; - xfree((*jobinfo)->bgl_part_id); + xfree((*jobinfo)->bg_block_id); xfree(*jobinfo); } return rc; @@ -654,7 +654,7 @@ extern int select_g_pack_jobinfo (select_jobinfo_t jobinfo, Buf buffer) pack16(jobinfo->geometry[i], buffer); pack16(jobinfo->conn_type, buffer); pack16(jobinfo->rotate, buffer); - packstr(jobinfo->bgl_part_id, buffer); + packstr(jobinfo->bg_block_id, buffer); } else { for (i=0; i<(SYSTEM_DIMENSIONS+3); i++) pack16((uint16_t) 0, buffer); @@ -679,7 +679,7 @@ extern int select_g_unpack_jobinfo(select_jobinfo_t jobinfo, Buf buffer) safe_unpack16(&(jobinfo->geometry[i]), buffer); safe_unpack16(&(jobinfo->conn_type), buffer); safe_unpack16(&(jobinfo->rotate), buffer); - safe_unpackstr_xmalloc(&(jobinfo->bgl_part_id), &uint16_tmp, buffer); + safe_unpackstr_xmalloc(&(jobinfo->bg_block_id), &uint16_tmp, buffer); return SLURM_SUCCESS; unpack_error: @@ -734,7 +734,7 @@ extern char *select_g_sprint_jobinfo(select_jobinfo_t jobinfo, _job_conn_type_string(jobinfo->conn_type), _job_rotate_string(jobinfo->rotate), geometry[0], geometry[1], geometry[2], - jobinfo->bgl_part_id); + jobinfo->bg_block_id); break; case SELECT_PRINT_MIXED: snprintf(buf, size, @@ -743,10 +743,10 @@ extern char *select_g_sprint_jobinfo(select_jobinfo_t jobinfo, _job_conn_type_string(jobinfo->conn_type), _job_rotate_string(jobinfo->rotate), geometry[0], geometry[1], geometry[2], - jobinfo->bgl_part_id); + jobinfo->bg_block_id); break; - case SELECT_PRINT_BGL_ID: - return jobinfo->bgl_part_id; + case SELECT_PRINT_BG_ID: + return jobinfo->bg_block_id; break; default: error("select_g_sprint_jobinfo: bad mode %d", mode); @@ -761,45 +761,45 @@ extern char *select_g_sprint_jobinfo(select_jobinfo_t jobinfo, * plugin. The unpack functions can not be there since the plugin is * dependent upon libraries which do not exist on the BlueGene front-end * nodes. */ -static int _unpack_node_info(bgl_info_record_t *bgl_info_record, Buf buffer) +static int _unpack_node_info(bg_info_record_t *bg_info_record, Buf buffer) { uint16_t uint16_tmp; uint32_t uint32_tmp; - safe_unpackstr_xmalloc(&(bgl_info_record->nodes), &uint16_tmp, buffer); - safe_unpackstr_xmalloc(&bgl_info_record->owner_name, &uint16_tmp, + safe_unpackstr_xmalloc(&(bg_info_record->nodes), &uint16_tmp, buffer); + safe_unpackstr_xmalloc(&bg_info_record->owner_name, &uint16_tmp, buffer); - safe_unpackstr_xmalloc(&bgl_info_record->bgl_part_id, &uint16_tmp, + safe_unpackstr_xmalloc(&bg_info_record->bg_block_id, &uint16_tmp, buffer); safe_unpack16(&uint16_tmp, buffer); - bgl_info_record->state = (int) uint16_tmp; + bg_info_record->state = (int) uint16_tmp; safe_unpack16(&uint16_tmp, buffer); - bgl_info_record->conn_type = (int) uint16_tmp; + bg_info_record->conn_type = (int) uint16_tmp; safe_unpack16(&uint16_tmp, buffer); - bgl_info_record->node_use = (int) uint16_tmp; + bg_info_record->node_use = (int) uint16_tmp; safe_unpack32(&uint32_tmp, buffer); - bgl_info_record->quarter = (int) uint32_tmp; + bg_info_record->quarter = (int) uint32_tmp; return SLURM_SUCCESS; unpack_error: - if(bgl_info_record->nodes) - xfree(bgl_info_record->nodes); - if(bgl_info_record->owner_name) - xfree(bgl_info_record->owner_name); - if(bgl_info_record->bgl_part_id) - xfree(bgl_info_record->bgl_part_id); + if(bg_info_record->nodes) + xfree(bg_info_record->nodes); + if(bg_info_record->owner_name) + xfree(bg_info_record->owner_name); + if(bg_info_record->bg_block_id) + xfree(bg_info_record->bg_block_id); return SLURM_ERROR; } -static void _free_node_info(bgl_info_record_t *bgl_info_record) +static void _free_node_info(bg_info_record_t *bg_info_record) { - if(bgl_info_record->nodes) - xfree(bgl_info_record->nodes); - if(bgl_info_record->owner_name) - xfree(bgl_info_record->owner_name); - if(bgl_info_record->bgl_part_id) - xfree(bgl_info_record->bgl_part_id); + if(bg_info_record->nodes) + xfree(bg_info_record->nodes); + if(bg_info_record->owner_name) + xfree(bg_info_record->owner_name); + if(bg_info_record->bg_block_id) + xfree(bg_info_record->bg_block_id); } /* Unpack node select info from a buffer */ @@ -809,15 +809,15 @@ extern int select_g_unpack_node_info(node_select_info_msg_t ** int i, record_count = 0; node_select_info_msg_t *buf; - buf = xmalloc(sizeof(bgl_info_record_t)); + buf = xmalloc(sizeof(bg_info_record_t)); safe_unpack32(&(buf->record_count), buffer); safe_unpack_time(&(buf->last_update), buffer); - buf->bgl_info_array = xmalloc(sizeof(bgl_info_record_t) * + buf->bg_info_array = xmalloc(sizeof(bg_info_record_t) * buf->record_count); record_count = buf->record_count; for(i=0; i<record_count; i++) { - if (_unpack_node_info(&(buf->bgl_info_array[i]), buffer)) + if (_unpack_node_info(&(buf->bg_info_array[i]), buffer)) goto unpack_error; } *node_select_info_msg_pptr = buf; @@ -825,8 +825,8 @@ extern int select_g_unpack_node_info(node_select_info_msg_t ** unpack_error: for(i=0; i<record_count; i++) - _free_node_info(&(buf->bgl_info_array[i])); - xfree(buf->bgl_info_array); + _free_node_info(&(buf->bg_info_array[i])); + xfree(buf->bg_info_array); xfree(buf); return SLURM_ERROR; } @@ -842,15 +842,15 @@ extern int select_g_free_node_info(node_select_info_msg_t ** return EINVAL; buf = *node_select_info_msg_pptr; - if (buf->bgl_info_array == NULL) + if (buf->bg_info_array == NULL) buf->record_count = 0; for(i=0; i<buf->record_count; i++) - _free_node_info(&(buf->bgl_info_array[i])); + _free_node_info(&(buf->bg_info_array[i])); xfree(buf); return SLURM_SUCCESS; } -#else /* !HAVE_BGL */ +#else /* !HAVE_BG */ /* allocate storage for a select job credential * OUT jobinfo - storage for a select job credential diff --git a/src/common/read_config.c b/src/common/read_config.c index 48aa284e337cbd75a25d7637dc1ace018cd2a56a..08b3b703adfdf3a3f04ccb5277c71c1d64b4f906 100644 --- a/src/common/read_config.c +++ b/src/common/read_config.c @@ -617,7 +617,7 @@ parse_config_spec (char *in_line, slurm_ctl_conf_t *ctl_conf_ptr) if ( inactive_limit != -1) { if ( ctl_conf_ptr->inactive_limit != (uint16_t) NO_VAL) error (MULTIPLE_VALUE_MSG, "InactiveLimit"); -#ifdef HAVE_BGL /* Inactive limit must be zero on Blue Gene */ +#ifdef HAVE_BG /* Inactive limit must be zero on Blue Gene */ if (inactive_limit) { error("InactiveLimit=%ld is invalid on Blue Gene", inactive_limit); diff --git a/src/common/read_config.h b/src/common/read_config.h index 85a03b1616a5a2cb8e6cfa7b5bd48a7f6dd2d584..512fa35cafeb1fee736b7c9f58a09b786fcef824 100644 --- a/src/common/read_config.h +++ b/src/common/read_config.h @@ -58,7 +58,7 @@ #define DEFAULT_SAVE_STATE_LOC "/tmp" #define DEFAULT_SCHEDROOTFILTER 1 #define DEFAULT_SCHEDTYPE "sched/builtin" -#ifdef HAVE_BGL /* Blue Gene specific default configuration parameters */ +#ifdef HAVE_BG /* Blue Gene specific default configuration parameters */ # define DEFAULT_SELECT_TYPE "select/bluegene" #else # define DEFAULT_SELECT_TYPE "select/linear" diff --git a/src/plugins/sched/backfill/backfill_wrapper.c b/src/plugins/sched/backfill/backfill_wrapper.c index ea343b7a83be09750bdb7adf0eb7f5d7f23f1cb4..b25b9831eedc9dab40ae980a6de953d2523a42f9 100644 --- a/src/plugins/sched/backfill/backfill_wrapper.c +++ b/src/plugins/sched/backfill/backfill_wrapper.c @@ -51,7 +51,7 @@ static pthread_mutex_t thread_flag_mutex = PTHREAD_MUTEX_INITIALIZER; /**************************************************************************/ int init( void ) { -#ifdef HAVE_BGL +#ifdef HAVE_BG /* Backfill scheduling on Blue Gene is possible, * but difficult and would require substantial * software development to accomplish. diff --git a/src/plugins/select/bluegene/Makefile.am b/src/plugins/select/bluegene/Makefile.am index f9073d8a91ae51fff9bb8da69075513be32a8ef3..d7a3390326bd8f81f095ef03389dfc2cad7084c0 100644 --- a/src/plugins/select/bluegene/Makefile.am +++ b/src/plugins/select/bluegene/Makefile.am @@ -1,41 +1,4 @@ -# $Id$ +# $Id: Makefile.am 6637 2005-11-17 21:52:28Z da $ # Makefile for select/bluegene plugin -CPPFLAGS = -DBLUEGENE_CONFIG_FILE=\"$(sysconfdir)/bluegene.conf\" -AUTOMAKE_OPTIONS = foreign - -PLUGIN_FLAGS = -module -avoid-version --export-dynamic -lm - -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common $(BGL_INCLUDES) - -pkglib_LTLIBRARIES = select_bluegene.la - -# Blue Gene node selection plugin. -select_bluegene_la_SOURCES = select_bluegene.c \ - bgl_job_place.c bgl_job_place.h \ - bgl_job_run.c bgl_job_run.h \ - bgl_part_info.c bgl_part_info.h \ - bluegene.c bluegene.h \ - state_test.c state_test.h \ - bgl_switch_connections.c \ - partition_sys.c \ - wrap_rm_api.h - -select_bluegene_la_LDFLAGS = $(SO_LDFLAGS) $(PLUGIN_FLAGS) - -select_bluegene_la_LIBADD = $(top_builddir)/src/partition_allocator/libpartition_allocator.la - -sbin_PROGRAMS = slurm_prolog slurm_epilog sfree - -sfree_LDADD = $(top_builddir)/src/common/libcommon.la \ - $(top_builddir)/src/api/libslurm.la -slurm_prolog_LDADD = $(top_builddir)/src/common/libcommon.la \ - $(top_builddir)/src/api/libslurm.la -slurm_epilog_LDADD = $(top_builddir)/src/common/libcommon.la \ - $(top_builddir)/src/api/libslurm.la -sfree_SOURCES = sfree.c sfree.h opts.c -slurm_prolog_SOURCES = slurm_prolog.c -slurm_epilog_SOURCES = slurm_epilog.c -sfree_LDFLAGS = -export-dynamic -lm $(CMD_LDFLAGS) $(BGL_LDFLAGS) -slurm_prolog_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) -slurm_epilog_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) +SUBDIRS = block_allocator plugin diff --git a/src/partition_allocator/Makefile.am b/src/plugins/select/bluegene/block_allocator/Makefile.am similarity index 60% rename from src/partition_allocator/Makefile.am rename to src/plugins/select/bluegene/block_allocator/Makefile.am index 75c84584c81002fc0b98bd9b2e810d52627bb43e..cfdbab296e6a3a794302de79abc4db43fdf3af51 100644 --- a/src/partition_allocator/Makefile.am +++ b/src/plugins/select/bluegene/block_allocator/Makefile.am @@ -1,10 +1,10 @@ # $Id$ -# Makefile.am for graph_solver +# Makefile.am for bluegene_block_allocator AUTOMAKE_OPTIONS = foreign CLEANFILES = core.* -INCLUDES = -I$(top_srcdir) $(BGL_INCLUDES) +INCLUDES = -I$(top_srcdir) $(BG_INCLUDES) #to build the executable # noinst_PROGRAMS = partition_allocator @@ -15,22 +15,22 @@ INCLUDES = -I$(top_srcdir) $(BGL_INCLUDES) # $(top_builddir)/src/common/libcommon.la -lpthread \ # $(top_builddir)/src/api/libslurm.la -# partition_allocator_LDFLAGS = -export-dynamic -lm $(CMD_LDFLAGS) $(BGL_LDFLAGS) +# partition_allocator_LDFLAGS = -export-dynamic -lm $(CMD_LDFLAGS) $(BG_LDFLAGS) # CPPFLAGS = -DBUILD_EXE # making a .la -noinst_LTLIBRARIES = libpartition_allocator.la -libpartition_allocator_la_SOURCES = \ - partition_allocator.c partition_allocator.h +noinst_LTLIBRARIES = libbluegene_block_allocator.la +libbluegene_block_allocator_la_SOURCES = \ + block_allocator.c block_allocator.h -libpartition_allocator_la_LIBADD = \ +libbluegene_block_allocator_la_LIBADD = \ $(top_builddir)/src/common/libcommon.la -lpthread \ $(top_builddir)/src/api/libslurm.la -libpartition_allocator_la_LDFLAGS = \ +libbluegene_block_allocator_la_LDFLAGS = \ $(LIB_LDFLAGS) -lm -libpartition_allocator_la_DEPENDENCIES = \ +libbluegene_block_allocator_la_DEPENDENCIES = \ $(top_builddir)/src/common/libcommon.la diff --git a/src/partition_allocator/partition_allocator.c b/src/plugins/select/bluegene/block_allocator/block_allocator.c similarity index 71% rename from src/partition_allocator/partition_allocator.c rename to src/plugins/select/bluegene/block_allocator/block_allocator.c index 2569df8577e073eb942896b84e03a3f675d07ef1..e78cf774b5e0bbdba474eb16840ab4413fdca0af 100644 --- a/src/partition_allocator/partition_allocator.c +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * partition_allocator.c - Assorted functions for layout of bglblocks, + * block_allocator.c - Assorted functions for layout of bglblocks, * wiring, mapping for smap, etc. * $Id$ ***************************************************************************** @@ -32,19 +32,19 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#include "src/partition_allocator/partition_allocator.h" +#include "block_allocator.h" -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES # include "src/plugins/select/bluegene/wrap_rm_api.h" #endif #define DEBUG_PA #define BEST_COUNT_INIT 20 -#ifdef HAVE_BGL -int DIM_SIZE[PA_SYSTEM_DIMENSIONS] = {0,0,0}; +#ifdef HAVE_BG +int DIM_SIZE[BA_SYSTEM_DIMENSIONS] = {0,0,0}; #else -int DIM_SIZE[PA_SYSTEM_DIMENSIONS] = {0}; +int DIM_SIZE[BA_SYSTEM_DIMENSIONS] = {0}; #endif bool _initialized = false; @@ -52,9 +52,9 @@ bool _wires_initialized = false; bool _bp_map_initialized = false; bool have_db2 = false; -/* _pa_system is the "current" system that the structures will work +/* _ba_system is the "current" system that the structures will work * on */ -pa_system_t *pa_system_ptr = NULL; +ba_system_t *ba_system_ptr = NULL; List path = NULL; List best_path = NULL; int best_count; @@ -63,78 +63,78 @@ char letters[62]; char colors[6]; /** internal helper functions */ -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES /** */ static void _bp_map_list_del(void *object); #endif -#ifdef HAVE_BGL +#ifdef HAVE_BG /* */ -static int _check_for_options(pa_request_t* pa_request); +static int _check_for_options(ba_request_t* ba_request); /* */ static int _append_geo(int *geo, List geos, int rotate); /* */ static int _fill_in_coords(List results, List start_list, int *geometry, int conn_type); /* */ -static int _copy_the_path(pa_switch_t *curr_switch, pa_switch_t *mark_switch, +static int _copy_the_path(ba_switch_t *curr_switch, ba_switch_t *mark_switch, int source, int dim); /* */ -static int _find_yz_path(pa_node_t *pa_node, int *first, +static int _find_yz_path(ba_node_t *ba_node, int *first, int *geometry, int conn_type); /* */ -static int _create_config_even(pa_node_t ***grid); +static int _create_config_even(ba_node_t ***grid); #else /* */ -static int _create_config_even(pa_node_t *grid); +static int _create_config_even(ba_node_t *grid); #endif /** */ -static void _new_pa_node(pa_node_t *pa_node, +static void _new_ba_node(ba_node_t *ba_node, int *coord); /** */ -static int _reset_the_path(pa_switch_t *curr_switch, int source, +static int _reset_the_path(ba_switch_t *curr_switch, int source, int target, int dim); /** */ -static void _create_pa_system(void); +static void _create_ba_system(void); /* */ -static void _delete_pa_system(void); +static void _delete_ba_system(void); /* */ static void _delete_path_list(void *object); -/* find the first partition match in the system */ -static int _find_match(pa_request_t* pa_request, List results); +/* find the first block match in the system */ +static int _find_match(ba_request_t* ba_request, List results); -static bool _node_used(pa_node_t* pa_node, int *geometry); +static bool _node_used(ba_node_t* ba_node, int *geometry); /* */ -static void _switch_config(pa_node_t* source, pa_node_t* target, int dim, +static void _switch_config(ba_node_t* source, ba_node_t* target, int dim, int port_src, int port_tar); /* */ -static int _set_external_wires(int dim, int count, pa_node_t* source, - pa_node_t* target); +static int _set_external_wires(int dim, int count, ba_node_t* source, + ba_node_t* target); /* */ static char *_set_internal_wires(List nodes, int size, int conn_type); /* */ -static int _find_x_path(List results, pa_node_t *pa_node, +static int _find_x_path(List results, ba_node_t *ba_node, int *start, int *first, int *geometry, int found, int conn_type); /* */ -static int _find_x_path2(List results, pa_node_t *pa_node, +static int _find_x_path2(List results, ba_node_t *ba_node, int *start, int *first, int *geometry, int found, int conn_type); /* */ static int _remove_node(List results, int *node_tar); /* */ -static int _find_next_free_using_port_2(pa_switch_t *curr_switch, +static int _find_next_free_using_port_2(ba_switch_t *curr_switch, int source_port, List nodes, int dim, int count); /* */ -static int _find_passthrough(pa_switch_t *curr_switch, int source_port, +static int _find_passthrough(ba_switch_t *curr_switch, int source_port, List nodes, int dim, int count, int highest_phys_x); /* */ -static int _finish_torus(pa_switch_t *curr_switch, int source_port, +static int _finish_torus(ba_switch_t *curr_switch, int source_port, List nodes, int dim, int count, int *start); /* */ static int *_set_best_path(); @@ -144,32 +144,32 @@ static int _set_one_dim(int *start, int *end, int *coord); /* Global */ List bp_map_list; -List bgl_info_list; +List bg_info_list; -extern void destroy_bgl_info_record(void* object) +extern void destroy_bg_info_record(void* object) { - bgl_info_record_t* bgl_info_record = (bgl_info_record_t*) object; + bg_info_record_t* bg_info_record = (bg_info_record_t*) object; - if (bgl_info_record) { - if(bgl_info_record->nodes) - xfree(bgl_info_record->nodes); - if(bgl_info_record->owner_name) - xfree(bgl_info_record->owner_name); - if(bgl_info_record->bgl_part_id) - xfree(bgl_info_record->bgl_part_id); + if (bg_info_record) { + if(bg_info_record->nodes) + xfree(bg_info_record->nodes); + if(bg_info_record->owner_name) + xfree(bg_info_record->owner_name); + if(bg_info_record->bg_block_id) + xfree(bg_info_record->bg_block_id); - xfree(bgl_info_record); + xfree(bg_info_record); } } /** - * create a partition request. Note that if the geometry is given, + * create a block request. Note that if the geometry is given, * then size is ignored. * - * OUT - pa_request: structure to allocate and fill in. - * IN - geometry: requested geometry of partition - * IN - size: requested size of partition - * IN - rotate: if true, allows rotation of partition during fit + * OUT - ba_request: structure to allocate and fill in. + * IN - geometry: requested geometry of block + * IN - size: requested size of block + * IN - rotate: if true, allows rotation of block during fit * IN - elongate: if true, will try to fit different geometries of * same size requests * IN - contig: enforce contiguous regions constraint @@ -177,30 +177,30 @@ extern void destroy_bgl_info_record(void* object) * * return SUCCESS of operation. */ -extern int new_pa_request(pa_request_t* pa_request) +extern int new_ba_request(ba_request_t* ba_request) { int i=0; -#ifdef HAVE_BGL +#ifdef HAVE_BG float sz=1; - int geo[PA_SYSTEM_DIMENSIONS] = {0,0,0}; + int geo[BA_SYSTEM_DIMENSIONS] = {0,0,0}; int i2, i3, picked, total_sz=1 , size2, size3; ListIterator itr; int checked[8]; int *geo_ptr; int messed_with = 0; - pa_request->rotate_count= 0; - pa_request->elongate_count = 0; - pa_request->elongate_geos = list_create(NULL); - geo[X] = pa_request->geometry[X]; - geo[Y] = pa_request->geometry[Y]; - geo[Z] = pa_request->geometry[Z]; + ba_request->rotate_count= 0; + ba_request->elongate_count = 0; + ba_request->elongate_geos = list_create(NULL); + geo[X] = ba_request->geometry[X]; + geo[Y] = ba_request->geometry[Y]; + geo[Z] = ba_request->geometry[Z]; if(geo[X] != -1) { - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++){ + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){ if ((geo[i] < 1) || (geo[i] > DIM_SIZE[i])){ - error("new_pa_request Error, " + error("new_ba_request Error, " "request geometry is invalid %d " "DIMS are %d%d%d", geo[i], @@ -210,93 +210,93 @@ extern int new_pa_request(pa_request_t* pa_request) return 0; } } - _append_geo(geo, pa_request->elongate_geos, 0); + _append_geo(geo, ba_request->elongate_geos, 0); sz=1; - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++) - sz *= pa_request->geometry[i]; - pa_request->size = sz; + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++) + sz *= ba_request->geometry[i]; + ba_request->size = sz; sz=0; } - if(pa_request->elongate || sz) { + if(ba_request->elongate || sz) { sz=1; /* decompose the size into a cubic geometry */ - pa_request->rotate= 1; - pa_request->elongate = 1; + ba_request->rotate= 1; + ba_request->elongate = 1; - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++) { + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++) { total_sz *= DIM_SIZE[i]; geo[i] = 1; } - if(pa_request->size==1) { + if(ba_request->size==1) { _append_geo(geo, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->elongate_geos, + ba_request->rotate); goto endit; } - if(pa_request->size<=DIM_SIZE[Y]) { + if(ba_request->size<=DIM_SIZE[Y]) { geo[X] = 1; - geo[Y] = pa_request->size; + geo[Y] = ba_request->size; geo[Z] = 1; - sz=pa_request->size; + sz=ba_request->size; _append_geo(geo, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->elongate_geos, + ba_request->rotate); } - i = pa_request->size/4; - if(!(pa_request->size%2) + i = ba_request->size/4; + if(!(ba_request->size%2) && i <= DIM_SIZE[Y] && i <= DIM_SIZE[Z] - && i*i == pa_request->size) { + && i*i == ba_request->size) { geo[X] = 1; geo[Y] = i; geo[Z] = i; - sz=pa_request->size; + sz=ba_request->size; _append_geo(geo, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->elongate_geos, + ba_request->rotate); } - if(pa_request->size>total_sz || pa_request->size<1) { + if(ba_request->size>total_sz || ba_request->size<1) { return 0; } - sz = pa_request->size % (DIM_SIZE[Y] * DIM_SIZE[Z]); + sz = ba_request->size % (DIM_SIZE[Y] * DIM_SIZE[Z]); if(!sz) { - i = pa_request->size / (DIM_SIZE[Y] * DIM_SIZE[Z]); + i = ba_request->size / (DIM_SIZE[Y] * DIM_SIZE[Z]); geo[X] = i; geo[Y] = DIM_SIZE[Y]; geo[Z] = DIM_SIZE[Z]; - sz=pa_request->size; + sz=ba_request->size; _append_geo(geo, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->elongate_geos, + ba_request->rotate); } startagain: picked=0; for(i=0;i<8;i++) checked[i]=0; - size3=pa_request->size; + size3=ba_request->size; - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++) { + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++) { total_sz *= DIM_SIZE[i]; geo[i] = 1; } sz = 1; - size3=pa_request->size; + size3=ba_request->size; picked=0; tryagain: - if(size3!=pa_request->size) + if(size3!=ba_request->size) size2=size3; else - size2=pa_request->size; + size2=ba_request->size; //messedup: - for (i=picked; i<PA_SYSTEM_DIMENSIONS; i++) { + for (i=picked; i<BA_SYSTEM_DIMENSIONS; i++) { if(size2<=1) break; sz = size2%DIM_SIZE[i]; @@ -321,12 +321,12 @@ extern int new_pa_request(pa_request_t* pa_request) goto tryagain; } if((i2-1)!=1 && - i!=(PA_SYSTEM_DIMENSIONS-1)) + i!=(BA_SYSTEM_DIMENSIONS-1)) break; } } if(i2==1) { - pa_request->size +=1; + ba_request->size +=1; goto startagain; } @@ -337,40 +337,40 @@ extern int new_pa_request(pa_request_t* pa_request) } if((geo[X]*geo[Y]) <= DIM_SIZE[Y]) { - pa_request->geometry[X] = 1; - pa_request->geometry[Y] = geo[X] * geo[Y]; - pa_request->geometry[Z] = geo[Z]; - _append_geo(pa_request->geometry, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->geometry[X] = 1; + ba_request->geometry[Y] = geo[X] * geo[Y]; + ba_request->geometry[Z] = geo[Z]; + _append_geo(ba_request->geometry, + ba_request->elongate_geos, + ba_request->rotate); } if((geo[X]*geo[Z]) <= DIM_SIZE[Y]) { - pa_request->geometry[X] = 1; - pa_request->geometry[Y] = geo[Y]; - pa_request->geometry[Z] = geo[X] * geo[Z]; - _append_geo(pa_request->geometry, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->geometry[X] = 1; + ba_request->geometry[Y] = geo[Y]; + ba_request->geometry[Z] = geo[X] * geo[Z]; + _append_geo(ba_request->geometry, + ba_request->elongate_geos, + ba_request->rotate); } if((geo[X]/2) <= DIM_SIZE[Y]) { if(geo[Y] == 1) { - pa_request->geometry[Y] = geo[X]/2; + ba_request->geometry[Y] = geo[X]/2; messed_with = 1; } else - pa_request->geometry[Y] = geo[Y]; + ba_request->geometry[Y] = geo[Y]; if(!messed_with && geo[Z] == 1) { messed_with = 1; - pa_request->geometry[Z] = geo[X]/2; + ba_request->geometry[Z] = geo[X]/2; } else - pa_request->geometry[Z] = geo[Z]; + ba_request->geometry[Z] = geo[Z]; if(messed_with) { messed_with = 0; - pa_request->geometry[X] = 2; - _append_geo(pa_request->geometry, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->geometry[X] = 2; + _append_geo(ba_request->geometry, + ba_request->elongate_geos, + ba_request->rotate); } } if(geo[X] == DIM_SIZE[X] @@ -381,107 +381,107 @@ extern int new_pa_request(pa_request_t* pa_request) DIM_SIZE[Y] = DIM_SIZE[Z]; DIM_SIZE[Z] = i; } - pa_request->geometry[X] = geo[X]; - pa_request->geometry[Y] = geo[Y]; - pa_request->geometry[Z] = geo[Z]; - if(pa_request->geometry[Y] < DIM_SIZE[Y]) { - i = (DIM_SIZE[Y] - pa_request->geometry[Y]); - pa_request->geometry[Y] +=i; + ba_request->geometry[X] = geo[X]; + ba_request->geometry[Y] = geo[Y]; + ba_request->geometry[Z] = geo[Z]; + if(ba_request->geometry[Y] < DIM_SIZE[Y]) { + i = (DIM_SIZE[Y] - ba_request->geometry[Y]); + ba_request->geometry[Y] +=i; } - if(pa_request->geometry[Z] < DIM_SIZE[Z]) { - i = (DIM_SIZE[Z] - pa_request->geometry[Z]); - pa_request->geometry[Z] +=i; + if(ba_request->geometry[Z] < DIM_SIZE[Z]) { + i = (DIM_SIZE[Z] - ba_request->geometry[Z]); + ba_request->geometry[Z] +=i; } for(i = DIM_SIZE[X]; i>0; i--) { - pa_request->geometry[X]--; - i2 = (pa_request->geometry[X] - * pa_request->geometry[Y] - * pa_request->geometry[Z]); - if(i2 < pa_request->size) { - pa_request->geometry[X]++; + ba_request->geometry[X]--; + i2 = (ba_request->geometry[X] + * ba_request->geometry[Y] + * ba_request->geometry[Z]); + if(i2 < ba_request->size) { + ba_request->geometry[X]++; messed_with = 1; break; } } if(messed_with) { messed_with = 0; - _append_geo(pa_request->geometry, - pa_request->elongate_geos, - pa_request->rotate); + _append_geo(ba_request->geometry, + ba_request->elongate_geos, + ba_request->rotate); } } _append_geo(geo, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->elongate_geos, + ba_request->rotate); /* see if We can find a cube or square root of the size to make an easy cube */ - for(i=0;i<PA_SYSTEM_DIMENSIONS-1;i++) { - sz = powf((float)pa_request->size, - (float)1/(PA_SYSTEM_DIMENSIONS-i)); - if(pow(sz,(PA_SYSTEM_DIMENSIONS-i))==pa_request->size) + for(i=0;i<BA_SYSTEM_DIMENSIONS-1;i++) { + sz = powf((float)ba_request->size, + (float)1/(BA_SYSTEM_DIMENSIONS-i)); + if(pow(sz,(BA_SYSTEM_DIMENSIONS-i))==ba_request->size) break; } - if(i<PA_SYSTEM_DIMENSIONS-1) { + if(i<BA_SYSTEM_DIMENSIONS-1) { /* we found something that looks like a cube! */ i3=i; for (i=0; i<i3; i++) geo[i] = 1; - for (i=i3; i<PA_SYSTEM_DIMENSIONS; i++) + for (i=i3; i<BA_SYSTEM_DIMENSIONS; i++) if(sz<=DIM_SIZE[i]) geo[i] = sz; else goto endit; _append_geo(geo, - pa_request->elongate_geos, - pa_request->rotate); + ba_request->elongate_geos, + ba_request->rotate); } } endit: - itr = list_iterator_create(pa_request->elongate_geos); + itr = list_iterator_create(ba_request->elongate_geos); geo_ptr = list_next(itr); list_iterator_destroy(itr); if(geo_ptr == NULL) return 0; - pa_request->elongate_count++; - pa_request->geometry[X] = geo_ptr[X]; - pa_request->geometry[Y] = geo_ptr[Y]; - pa_request->geometry[Z] = geo_ptr[Z]; + ba_request->elongate_count++; + ba_request->geometry[X] = geo_ptr[X]; + ba_request->geometry[Y] = geo_ptr[Y]; + ba_request->geometry[Z] = geo_ptr[Z]; sz=1; - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++) - sz *= pa_request->geometry[i]; - pa_request->size = sz; + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++) + sz *= ba_request->geometry[i]; + ba_request->size = sz; #else - int geo[PA_SYSTEM_DIMENSIONS] = {0}; + int geo[BA_SYSTEM_DIMENSIONS] = {0}; - pa_request->rotate_count= 0; - pa_request->elongate_count = 0; - pa_request->elongate_geos = list_create(NULL); - geo[X] = pa_request->geometry[X]; + ba_request->rotate_count= 0; + ba_request->elongate_count = 0; + ba_request->elongate_geos = list_create(NULL); + geo[X] = ba_request->geometry[X]; if(geo[X] != -1) { - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++){ + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){ if ((geo[i] < 1) || (geo[i] > DIM_SIZE[i])){ - error("new_pa_request Error, " + error("new_ba_request Error, " "request geometry is invalid %d", geo[i]); return 0; } } - pa_request->size = pa_request->geometry[X]; + ba_request->size = ba_request->geometry[X]; - } else if (pa_request->size) { - pa_request->geometry[X] = pa_request->size; + } else if (ba_request->size) { + ba_request->geometry[X] = ba_request->size; } else return 0; @@ -490,42 +490,42 @@ endit: } /** - * delete a partition request + * delete a block request */ -extern void delete_pa_request(pa_request_t *pa_request) +extern void delete_ba_request(ba_request_t *ba_request) { int *geo_ptr; - if(pa_request->save_name!=NULL) - xfree(pa_request->save_name); + if(ba_request->save_name!=NULL) + xfree(ba_request->save_name); - while((geo_ptr = list_pop(pa_request->elongate_geos)) != NULL) + while((geo_ptr = list_pop(ba_request->elongate_geos)) != NULL) xfree(geo_ptr); - xfree(pa_request); + xfree(ba_request); } /** - * print a partition request + * print a block request */ -extern void print_pa_request(pa_request_t* pa_request) +extern void print_ba_request(ba_request_t* ba_request) { int i; - if (pa_request == NULL){ - error("print_pa_request Error, request is NULL"); + if (ba_request == NULL){ + error("print_ba_request Error, request is NULL"); return; } - debug(" pa_request:"); + debug(" ba_request:"); debug(" geometry:\t"); - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++){ - debug("%d", pa_request->geometry[i]); - } - debug(" size:\t%d", pa_request->size); - debug(" conn_type:\t%d", pa_request->conn_type); - debug(" rotate:\t%d", pa_request->rotate); - debug(" elongate:\t%d", pa_request->elongate); - debug("force contig:\t%d", pa_request->force_contig); + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){ + debug("%d", ba_request->geometry[i]); + } + debug(" size:\t%d", ba_request->size); + debug(" conn_type:\t%d", ba_request->conn_type); + debug(" rotate:\t%d", ba_request->rotate); + debug(" elongate:\t%d", ba_request->elongate); + debug("force contig:\t%d", ba_request->force_contig); } /** @@ -550,7 +550,7 @@ static void _db2_check(void) } /** - * Initialize internal structures by either reading previous partition + * Initialize internal structures by either reading previous block * configurations from a file or by running the graph solver. * * IN: node_info_msg_t * can be null, @@ -558,19 +558,19 @@ static void _db2_check(void) * * return: void. */ -extern void pa_init(node_info_msg_t *node_info_ptr) +extern void ba_init(node_info_msg_t *node_info_ptr) { node_info_t *node_ptr = NULL; int start, temp; char *numeric = NULL; int x,y,z; -#ifdef HAVE_BGL +#ifdef HAVE_BG int i; #endif -#ifdef HAVE_BGL_FILES - rm_BGL_t *bgl = NULL; +#ifdef HAVE_BG_FILES + rm_BGL_t *bg = NULL; rm_size3D_t bp_size; int rc = 0; #endif @@ -601,15 +601,15 @@ extern void pa_init(node_info_msg_t *node_info_ptr) best_count=BEST_COUNT_INIT; - pa_system_ptr = (pa_system_t *) xmalloc(sizeof(pa_system_t)); + ba_system_ptr = (ba_system_t *) xmalloc(sizeof(ba_system_t)); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord = 1; - pa_system_ptr->num_of_proc = 0; - pa_system_ptr->resize_screen = 0; + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord = 1; + ba_system_ptr->num_of_proc = 0; + ba_system_ptr->resize_screen = 0; if(node_info_ptr!=NULL) { -#ifdef HAVE_BGL +#ifdef HAVE_BG for (i = 0; i < node_info_ptr->record_count; i++) { node_ptr = &node_info_ptr->node_array[i]; start = 0; @@ -648,23 +648,23 @@ extern void pa_init(node_info_msg_t *node_info_ptr) #else DIM_SIZE[X] = node_info_ptr->record_count; #endif - pa_system_ptr->num_of_proc = node_info_ptr->record_count; + ba_system_ptr->num_of_proc = node_info_ptr->record_count; } node_info_error: -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES if (have_db2 && (DIM_SIZE[X]==0) || (DIM_SIZE[Y]==0) || (DIM_SIZE[Z]==0)) { - if ((rc = rm_set_serial(BGL_SERIAL)) != STATUS_OK) { - error("rm_set_serial(%s): %d", BGL_SERIAL, rc); + if ((rc = rm_set_serial(BG_SERIAL)) != STATUS_OK) { + error("rm_set_serial(%s): %d", BG_SERIAL, rc); return; } - if ((rc = rm_get_BGL(&bgl)) != STATUS_OK) { + if ((rc = rm_get_BGL(&bg)) != STATUS_OK) { error("rm_get_BGL(): %d", rc); return; } - if ((bgl != NULL) - && ((rc = rm_get_data(bgl, RM_Msize, &bp_size)) + if ((bg != NULL) + && ((rc = rm_get_data(bg, RM_Msize, &bp_size)) == STATUS_OK)) { DIM_SIZE[X]=bp_size.X; DIM_SIZE[Y]=bp_size.Y; @@ -672,12 +672,12 @@ node_info_error: } else { error("rm_get_data(RM_Msize): %d", rc); } - if ((rc = rm_free_BGL(bgl)) != STATUS_OK) + if ((rc = rm_free_BGL(bg)) != STATUS_OK) error("rm_free_BGL(): %d", rc); } #endif -#ifdef HAVE_BGL +#ifdef HAVE_BG if ((DIM_SIZE[X]==0) || (DIM_SIZE[X]==0) || (DIM_SIZE[X]==0)) { debug("Setting default system dimensions"); DIM_SIZE[X]=8; @@ -692,21 +692,21 @@ node_info_error: DIM_SIZE[X]=100; } #endif - if(!pa_system_ptr->num_of_proc) - pa_system_ptr->num_of_proc = + if(!ba_system_ptr->num_of_proc) + ba_system_ptr->num_of_proc = DIM_SIZE[X] -#ifdef HAVE_BGL +#ifdef HAVE_BG * DIM_SIZE[Y] * DIM_SIZE[Z] #endif ; - _create_pa_system(); + _create_ba_system(); init_grid(node_info_ptr); -#ifndef HAVE_BGL_FILES - _create_config_even(pa_system_ptr->grid); +#ifndef HAVE_BG_FILES + _create_config_even(ba_system_ptr->grid); #endif path = list_create(_delete_path_list); best_path = list_create(_delete_path_list); @@ -717,17 +717,17 @@ node_info_error: extern void init_wires() { int x, y, z, i; - pa_node_t *source = NULL; + ba_node_t *source = NULL; if(_wires_initialized) return; for(x=0;x<DIM_SIZE[X];x++) { for(y=0;y<DIM_SIZE[Y];y++) { for(z=0;z<DIM_SIZE[Z];z++) { -#ifdef HAVE_BGL - source = &pa_system_ptr->grid[x][y][z]; +#ifdef HAVE_BG + source = &ba_system_ptr->grid[x][y][z]; #else - source = &pa_system_ptr->grid[x]; + source = &ba_system_ptr->grid[x]; #endif for(i=0; i<6; i++) { _switch_config(source, source, @@ -740,7 +740,7 @@ extern void init_wires() } } } -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES _set_external_wires(0,0,NULL,NULL); if(!bp_map_list) { if(set_bp_map() == -1) @@ -755,7 +755,7 @@ extern void init_wires() /** * destroy all the internal (global) data structs. */ -extern void pa_fini() +extern void ba_fini() { if (!_initialized){ return; @@ -765,11 +765,11 @@ extern void pa_fini() list_destroy(path); if (best_path) list_destroy(best_path); -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES if (bp_map_list) list_destroy(bp_map_list); #endif - _delete_pa_system(); + _delete_ba_system(); // debug2("pa system destroyed"); } @@ -780,7 +780,7 @@ extern void pa_fini() * * IN c: coordinate of the node to put down */ -extern void pa_set_node_down(pa_node_t *pa_node) +extern void ba_set_node_down(ba_node_t *ba_node) { if (!_initialized){ error("Error, configuration not initialized, " @@ -789,44 +789,44 @@ extern void pa_set_node_down(pa_node_t *pa_node) } #ifdef DEBUG_PA -#ifdef HAVE_BGL - debug("pa_set_node_down: node to set down: [%d%d%d]", - pa_node->coord[X], pa_node->coord[Y], pa_node->coord[Z]); +#ifdef HAVE_BG + debug("ba_set_node_down: node to set down: [%d%d%d]", + ba_node->coord[X], ba_node->coord[Y], ba_node->coord[Z]); #else - debug("pa_set_node_down: node to set down: [%d]", pa_node->coord[X]); + debug("ba_set_node_down: node to set down: [%d]", ba_node->coord[X]); #endif #endif /* basically set the node as used */ - pa_node->used = true; + ba_node->used = true; } /** - * Try to allocate a partition. + * Try to allocate a block. * - * IN - pa_request: allocation request + * IN - ba_request: allocation request * OUT - results: List of results of the allocation request. Each - * list entry will be a coordinate. allocate_part will create the + * list entry will be a coordinate. allocate_block will create the * list, but the caller must destroy it. * * return: success or error of request */ -extern int allocate_part(pa_request_t* pa_request, List results) +extern int allocate_block(ba_request_t* ba_request, List results) { if (!_initialized){ - error("allocate_part Error, configuration not initialized, " + error("allocate_block Error, configuration not initialized, " "call init_configuration first"); return 0; } - if (!pa_request){ - error("allocate_part Error, request not initialized"); + if (!ba_request){ + error("allocate_block Error, request not initialized"); return 0; } - // _backup_pa_system(); - if (_find_match(pa_request, results)){ + // _backup_ba_system(); + if (_find_match(ba_request, results)){ return 1; } else { return 0; @@ -840,20 +840,20 @@ extern int allocate_part(pa_request_t* pa_request, List results) * * returns SLURM_SUCCESS if undo was successful. */ -extern int remove_part(List nodes, int new_count) +extern int remove_block(List nodes, int new_count) { int dim; - pa_node_t* pa_node = NULL; - pa_switch_t *curr_switch = NULL; + ba_node_t* ba_node = NULL; + ba_switch_t *curr_switch = NULL; ListIterator itr; itr = list_iterator_create(nodes); - while((pa_node = (pa_node_t*) list_next(itr)) != NULL) { - pa_node->used = false; - pa_node->color = 7; - pa_node->letter = '.'; - for(dim=0;dim<PA_SYSTEM_DIMENSIONS;dim++) { - curr_switch = &pa_node->axis_switch[dim]; + while((ba_node = (ba_node_t*) list_next(itr)) != NULL) { + ba_node->used = false; + ba_node->color = 7; + ba_node->letter = '.'; + for(dim=0;dim<BA_SYSTEM_DIMENSIONS;dim++) { + curr_switch = &ba_node->axis_switch[dim]; if(curr_switch->int_wire[0].used) { _reset_the_path(curr_switch, 0, 1, dim); } @@ -870,22 +870,22 @@ extern int remove_part(List nodes, int new_count) * * returns SLURM_SUCCESS if undo was successful. */ -extern int alter_part(List nodes, int conn_type) +extern int alter_block(List nodes, int conn_type) { /* int dim; */ -/* pa_node_t* pa_node = NULL; */ -/* pa_switch_t *curr_switch = NULL; */ +/* ba_node_t* ba_node = NULL; */ +/* ba_switch_t *curr_switch = NULL; */ /* int size=0; */ /* char *name = NULL; */ /* ListIterator results_i; */ return SLURM_ERROR; /* results_i = list_iterator_create(nodes); */ -/* while ((pa_node = list_next(results_i)) != NULL) { */ -/* pa_node->used = false; */ +/* while ((ba_node = list_next(results_i)) != NULL) { */ +/* ba_node->used = false; */ -/* for(dim=0;dim<PA_SYSTEM_DIMENSIONS;dim++) { */ -/* curr_switch = &pa_node->axis_switch[dim]; */ +/* for(dim=0;dim<BA_SYSTEM_DIMENSIONS;dim++) { */ +/* curr_switch = &ba_node->axis_switch[dim]; */ /* if(curr_switch->int_wire[0].used) { */ /* _reset_the_path(curr_switch, 0, 1, dim); */ /* } */ @@ -902,25 +902,25 @@ extern int alter_part(List nodes, int conn_type) } /** - * After a partition is deleted or altered following allocations must + * After a block is deleted or altered following allocations must * be redone to make sure correct path will be used in the real system * */ -extern int redo_part(List nodes, int *geo, int conn_type, int new_count) +extern int redo_block(List nodes, int *geo, int conn_type, int new_count) { - pa_node_t* pa_node; + ba_node_t* ba_node; char *name = NULL; ListIterator itr; itr = list_iterator_create(nodes); - pa_node = list_next(itr); + ba_node = list_next(itr); list_iterator_destroy(itr); - remove_part(nodes, new_count); + remove_block(nodes, new_count); list_destroy(nodes); nodes = list_create(NULL); - name = set_bgl_part(nodes, pa_node->coord, geo, conn_type); + name = set_bg_block(nodes, ba_node->coord, geo, conn_type); if(!name) return SLURM_ERROR; else { @@ -929,11 +929,11 @@ extern int redo_part(List nodes, int *geo, int conn_type, int new_count) } } -extern char *set_bgl_part(List results, int *start, +extern char *set_bg_block(List results, int *start, int *geometry, int conn_type) { char *name = NULL; - pa_node_t* pa_node = NULL; + ba_node_t* ba_node = NULL; int size = 0; int send_results = 0; List start_list = NULL; @@ -945,51 +945,51 @@ extern char *set_bgl_part(List results, int *start, else send_results = 1; start_list = list_create(NULL); -#ifdef HAVE_BGL +#ifdef HAVE_BG if(start[X]>=DIM_SIZE[X] || start[Y]>=DIM_SIZE[Y] || start[Z]>=DIM_SIZE[Z]) return NULL; size = geometry[X] * geometry[Y] * geometry[Z]; - pa_node = &pa_system_ptr-> + ba_node = &ba_system_ptr-> grid[start[X]][start[Y]][start[Z]]; #else if(start[X]>=DIM_SIZE[X]) return NULL; size = geometry[X]; - pa_node = &pa_system_ptr-> + ba_node = &ba_system_ptr-> grid[start[X]]; #endif - if(!pa_node) + if(!ba_node) return NULL; - list_append(results, pa_node); - found = _find_x_path(results, pa_node, - pa_node->coord, - pa_node->coord, + list_append(results, ba_node); + found = _find_x_path(results, ba_node, + ba_node->coord, + ba_node->coord, geometry, 1, conn_type); if(!found) { debug("trying less efficient code"); - remove_part(results, color_count); + remove_block(results, color_count); list_destroy(results); results = list_create(NULL); - list_append(results, pa_node); - found = _find_x_path2(results, pa_node, - pa_node->coord, - pa_node->coord, + list_append(results, ba_node); + found = _find_x_path2(results, ba_node, + ba_node->coord, + ba_node->coord, geometry, 1, conn_type); } if(found) { -#ifdef HAVE_BGL +#ifdef HAVE_BG itr = list_iterator_create(results); - while((pa_node = (pa_node_t*) list_next(itr))) { - list_append(start_list, pa_node); + while((ba_node = (ba_node_t*) list_next(itr))) { + list_append(start_list, ba_node); } list_iterator_destroy(itr); @@ -1020,23 +1020,23 @@ extern char *set_bgl_part(List results, int *start, } -extern int reset_pa_system() +extern int reset_ba_system() { int x, y, z; - int coord[PA_SYSTEM_DIMENSIONS]; + int coord[BA_SYSTEM_DIMENSIONS]; for (x = 0; x < DIM_SIZE[X]; x++) for (y = 0; y < DIM_SIZE[Y]; y++) for (z = 0; z < DIM_SIZE[Z]; z++) { -#ifdef HAVE_BGL +#ifdef HAVE_BG coord[X] = x; coord[Y] = y; coord[Z] = z; - _new_pa_node(&pa_system_ptr->grid[x][y][z], + _new_ba_node(&ba_system_ptr->grid[x][y][z], coord); #else coord[X] = x; - _new_pa_node(&pa_system_ptr->grid[x], coord); + _new_ba_node(&ba_system_ptr->grid[x], coord); #endif } @@ -1049,10 +1049,10 @@ extern void init_grid(node_info_msg_t * node_info_ptr) node_info_t *node_ptr; int x, i = 0; uint16_t node_base_state; - /* For systems with more than 62 active jobs or BGL blocks, + /* For systems with more than 62 active jobs or BG blocks, * we just repeat letters */ -#ifdef HAVE_BGL +#ifdef HAVE_BG int y,z; for (x = 0; x < DIM_SIZE[X]; x++) for (y = 0; y < DIM_SIZE[Y]; y++) @@ -1062,38 +1062,38 @@ extern void init_grid(node_info_msg_t * node_info_ptr) &node_info_ptr->node_array[i]; node_base_state = node_ptr->node_state & NODE_STATE_BASE; - pa_system_ptr->grid[x][y][z].color = 7; + ba_system_ptr->grid[x][y][z].color = 7; if ((node_base_state == NODE_STATE_DOWN) || (node_ptr->node_state & NODE_STATE_DRAIN)) { - pa_system_ptr-> + ba_system_ptr-> grid[x][y][z].color = 0; - pa_system_ptr-> + ba_system_ptr-> grid[x][y][z].letter = '#'; if(_initialized) { - pa_set_node_down( - &pa_system_ptr-> + ba_set_node_down( + &ba_system_ptr-> grid[x][y][z]); } } else { - pa_system_ptr->grid[x][y][z]. + ba_system_ptr->grid[x][y][z]. color = 7; - pa_system_ptr->grid[x][y][z]. + ba_system_ptr->grid[x][y][z]. letter = '.'; } - pa_system_ptr->grid[x][y][z].state + ba_system_ptr->grid[x][y][z].state = node_ptr->node_state; } else { - pa_system_ptr->grid[x][y][z].color = 7; - pa_system_ptr->grid[x][y][z].letter + ba_system_ptr->grid[x][y][z].color = 7; + ba_system_ptr->grid[x][y][z].letter = '.'; - pa_system_ptr->grid[x][y][z].state = + ba_system_ptr->grid[x][y][z].state = NODE_STATE_IDLE; } - pa_system_ptr->grid[x][y][z].indecies = i++; + ba_system_ptr->grid[x][y][z].indecies = i++; } #else for (x = 0; x < DIM_SIZE[X]; x++) { @@ -1101,26 +1101,26 @@ extern void init_grid(node_info_msg_t * node_info_ptr) node_ptr = &node_info_ptr->node_array[i]; node_base_state = node_ptr->node_state & NODE_STATE_BASE; - pa_system_ptr->grid[x].color = 7; + ba_system_ptr->grid[x].color = 7; if ((node_base_state == NODE_STATE_DOWN) || (node_ptr->node_state & NODE_STATE_DRAIN)) { - pa_system_ptr->grid[x].color = 0; - pa_system_ptr->grid[x].letter = '#'; + ba_system_ptr->grid[x].color = 0; + ba_system_ptr->grid[x].letter = '#'; if(_initialized) { - pa_set_node_down( - &pa_system_ptr->grid[x]); + ba_set_node_down( + &ba_system_ptr->grid[x]); } } else { - pa_system_ptr->grid[x].color = 7; - pa_system_ptr->grid[x].letter = '.'; + ba_system_ptr->grid[x].color = 7; + ba_system_ptr->grid[x].letter = '.'; } - pa_system_ptr->grid[x].state = node_ptr->node_state; + ba_system_ptr->grid[x].state = node_ptr->node_state; } else { - pa_system_ptr->grid[x].color = 7; - pa_system_ptr->grid[x].letter = '.'; - pa_system_ptr->grid[x].state = NODE_STATE_IDLE; + ba_system_ptr->grid[x].color = 7; + ba_system_ptr->grid[x].letter = '.'; + ba_system_ptr->grid[x].state = NODE_STATE_IDLE; } - pa_system_ptr->grid[x].indecies = i++; + ba_system_ptr->grid[x].indecies = i++; } #endif return; @@ -1128,8 +1128,8 @@ extern void init_grid(node_info_msg_t * node_info_ptr) extern int *find_bp_loc(char* bp_id) { -#ifdef HAVE_BGL_FILES - pa_bp_map_t *bp_map = NULL; +#ifdef HAVE_BG_FILES + ba_bp_map_t *bp_map = NULL; ListIterator itr; if(!bp_map_list) { @@ -1154,11 +1154,11 @@ extern int *find_bp_loc(char* bp_id) extern char *find_bp_rack_mid(char* xyz) { -#ifdef HAVE_BGL_FILES - pa_bp_map_t *bp_map = NULL; +#ifdef HAVE_BG_FILES + ba_bp_map_t *bp_map = NULL; ListIterator itr; int number; - int coord[PA_SYSTEM_DIMENSIONS]; + int coord[BA_SYSTEM_DIMENSIONS]; int len = strlen(xyz); len -= 3; if(len<0) @@ -1192,10 +1192,10 @@ extern char *find_bp_rack_mid(char* xyz) /********************* Local Functions *********************/ -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES static void _bp_map_list_del(void *object) { - pa_bp_map_t *bp_map = (pa_bp_map_t *)object; + ba_bp_map_t *bp_map = (ba_bp_map_t *)object; if (bp_map) { xfree(bp_map->bp_id); @@ -1203,8 +1203,8 @@ static void _bp_map_list_del(void *object) } } #endif -#ifdef HAVE_BGL -static int _check_for_options(pa_request_t* pa_request) +#ifdef HAVE_BG +static int _check_for_options(ba_request_t* ba_request) { int temp; @@ -1212,30 +1212,30 @@ static int _check_for_options(pa_request_t* pa_request) int *geo = NULL; ListIterator itr; - if(pa_request->rotate) { + if(ba_request->rotate) { rotate_again: - debug2("Rotating! %d",pa_request->rotate_count); + debug2("Rotating! %d",ba_request->rotate_count); - if (pa_request->rotate_count==(PA_SYSTEM_DIMENSIONS-1)) { - temp=pa_request->geometry[X]; - pa_request->geometry[X]=pa_request->geometry[Z]; - pa_request->geometry[Z]=temp; - pa_request->rotate_count++; + if (ba_request->rotate_count==(BA_SYSTEM_DIMENSIONS-1)) { + temp=ba_request->geometry[X]; + ba_request->geometry[X]=ba_request->geometry[Z]; + ba_request->geometry[Z]=temp; + ba_request->rotate_count++; set=1; - } else if(pa_request->rotate_count<(PA_SYSTEM_DIMENSIONS*2)) { - temp=pa_request->geometry[X]; - pa_request->geometry[X]=pa_request->geometry[Y]; - pa_request->geometry[Y]=pa_request->geometry[Z]; - pa_request->geometry[Z]=temp; - pa_request->rotate_count++; + } else if(ba_request->rotate_count<(BA_SYSTEM_DIMENSIONS*2)) { + temp=ba_request->geometry[X]; + ba_request->geometry[X]=ba_request->geometry[Y]; + ba_request->geometry[Y]=ba_request->geometry[Z]; + ba_request->geometry[Z]=temp; + ba_request->rotate_count++; set=1; } else - pa_request->rotate = false; + ba_request->rotate = false; if(set) { - if(pa_request->geometry[X]<=DIM_SIZE[X] - && pa_request->geometry[Y]<=DIM_SIZE[Y] - && pa_request->geometry[Z]<=DIM_SIZE[Z]) + if(ba_request->geometry[X]<=DIM_SIZE[X] + && ba_request->geometry[Y]<=DIM_SIZE[Y] + && ba_request->geometry[Z]<=DIM_SIZE[Z]) return 1; else { set = 0; @@ -1243,26 +1243,26 @@ static int _check_for_options(pa_request_t* pa_request) } } } - if(pa_request->elongate) { + if(ba_request->elongate) { elongate_again: - debug2("Elongating! %d",pa_request->elongate_count); - pa_request->rotate_count=0; - pa_request->rotate = true; + debug2("Elongating! %d",ba_request->elongate_count); + ba_request->rotate_count=0; + ba_request->rotate = true; set = 0; - itr = list_iterator_create(pa_request->elongate_geos); - for(set=0; set<=pa_request->elongate_count; set++) + itr = list_iterator_create(ba_request->elongate_geos); + for(set=0; set<=ba_request->elongate_count; set++) geo = list_next(itr); list_iterator_destroy(itr); if(geo == NULL) return 0; - pa_request->elongate_count++; - pa_request->geometry[X] = geo[X]; - pa_request->geometry[Y] = geo[Y]; - pa_request->geometry[Z] = geo[Z]; - if(pa_request->geometry[X]<=DIM_SIZE[X] - && pa_request->geometry[Y]<=DIM_SIZE[Y] - && pa_request->geometry[Z]<=DIM_SIZE[Z]) { + ba_request->elongate_count++; + ba_request->geometry[X] = geo[X]; + ba_request->geometry[Y] = geo[Y]; + ba_request->geometry[Z] = geo[Z]; + if(ba_request->geometry[X]<=DIM_SIZE[X] + && ba_request->geometry[Y]<=DIM_SIZE[Y] + && ba_request->geometry[Z]<=DIM_SIZE[Z]) { return 1; } else goto elongate_again; @@ -1280,7 +1280,7 @@ static int _append_geo(int *geometry, List geos, int rotate) int i, j; geo = xmalloc(sizeof(int)*3); if(rotate) { - for (i = (PA_SYSTEM_DIMENSIONS - 1); i >= 0; i--) { + for (i = (BA_SYSTEM_DIMENSIONS - 1); i >= 0; i--) { for (j = 1; j <= i; j++) { if (geometry[j-1] > geometry[j]) { temp_geo = geometry[j-1]; @@ -1313,18 +1313,18 @@ static int _append_geo(int *geometry, List geos, int rotate) static int _fill_in_coords(List results, List start_list, int *geometry, int conn_type) { - pa_node_t *pa_node = NULL; - pa_node_t *check_node = NULL; + ba_node_t *ba_node = NULL; + ba_node_t *check_node = NULL; int rc = 1; ListIterator itr = NULL; int y=0, z=0, j; - pa_switch_t *curr_switch = NULL; - pa_switch_t *next_switch = NULL; + ba_switch_t *curr_switch = NULL; + ba_switch_t *next_switch = NULL; if(!start_list) return 0; itr = list_iterator_create(start_list); - while(check_node = (pa_node_t*) list_next(itr)) { + while(check_node = (ba_node_t*) list_next(itr)) { curr_switch = &check_node->axis_switch[X]; for(y=0; y<geometry[Y]; y++) { @@ -1339,25 +1339,25 @@ static int _fill_in_coords(List results, List start_list, rc = 0; goto failed; } - pa_node = &pa_system_ptr->grid + ba_node = &ba_system_ptr->grid [check_node->coord[X]] [check_node->coord[Y]+y] [check_node->coord[Z]+z]; - if(pa_node->coord[Y] + if(ba_node->coord[Y] == check_node->coord[Y] - && pa_node->coord[Z] + && ba_node->coord[Z] == check_node->coord[Z]) continue; - if (!_node_used(pa_node,geometry)) { + if (!_node_used(ba_node,geometry)) { debug2("here Adding %d%d%d", - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z]); - list_append(results, pa_node); - next_switch = &pa_node->axis_switch[X]; + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z]); + list_append(results, ba_node); + next_switch = &ba_node->axis_switch[X]; _copy_the_path(curr_switch, next_switch, - pa_node->coord[X], + ba_node->coord[X], 0); } else { rc = 0; @@ -1369,12 +1369,12 @@ static int _fill_in_coords(List results, List start_list, } list_iterator_destroy(itr); itr = list_iterator_create(start_list); - check_node = (pa_node_t*) list_next(itr); + check_node = (ba_node_t*) list_next(itr); list_iterator_destroy(itr); itr = list_iterator_create(results); - while(pa_node = (pa_node_t*) list_next(itr)) { - if(!_find_yz_path(pa_node, + while(ba_node = (ba_node_t*) list_next(itr)) { + if(!_find_yz_path(ba_node, check_node->coord, geometry, conn_type)){ @@ -1388,15 +1388,15 @@ failed: return rc; } -static int _copy_the_path(pa_switch_t *curr_switch, pa_switch_t *mark_switch, +static int _copy_the_path(ba_switch_t *curr_switch, ba_switch_t *mark_switch, int start, int source) { int *node_tar; int *mark_node_tar; int *node_curr; int port_tar, port_tar1; - pa_switch_t *next_switch = NULL; - pa_switch_t *next_mark_switch = NULL; + ba_switch_t *next_switch = NULL; + ba_switch_t *next_mark_switch = NULL; /*set the switch to not be used */ mark_switch->int_wire[source].used = @@ -1432,16 +1432,16 @@ static int _copy_the_path(pa_switch_t *curr_switch, pa_switch_t *mark_switch, debug2("something bad happened!!"); return 0; } - next_switch = &pa_system_ptr-> + next_switch = &ba_system_ptr-> grid[node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif .axis_switch[X]; - next_mark_switch = &pa_system_ptr-> + next_mark_switch = &ba_system_ptr-> grid[mark_node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [mark_node_tar[Y]] [mark_node_tar[Z]] #endif @@ -1451,13 +1451,13 @@ static int _copy_the_path(pa_switch_t *curr_switch, pa_switch_t *mark_switch, return 1; } -static int _find_yz_path(pa_node_t *pa_node, int *first, +static int _find_yz_path(ba_node_t *ba_node, int *first, int *geometry, int conn_type) { - pa_node_t *next_node = NULL; + ba_node_t *next_node = NULL; int *node_tar = NULL; - pa_switch_t *dim_curr_switch = NULL; - pa_switch_t *dim_next_switch = NULL; + ba_switch_t *dim_curr_switch = NULL; + ba_switch_t *dim_next_switch = NULL; int i2; int count = 0; @@ -1466,12 +1466,12 @@ static int _find_yz_path(pa_node_t *pa_node, int *first, debug3("%d node %d%d%d" " port 2 -> ", i2, - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z]); + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z]); dim_curr_switch = - &pa_node-> + &ba_node-> axis_switch[i2]; if(dim_curr_switch->int_wire[2].used) { debug2("returning here"); @@ -1481,7 +1481,7 @@ static int _find_yz_path(pa_node_t *pa_node, int *first, node_tar = dim_curr_switch-> ext_wire[2].node_tar; - next_node = &pa_system_ptr-> + next_node = &ba_system_ptr-> grid[node_tar[X]][node_tar[Y]][node_tar[Z]]; dim_next_switch = &next_node->axis_switch[i2]; debug3("%d%d%d port 5", @@ -1546,7 +1546,7 @@ static int _find_yz_path(pa_node_t *pa_node, int *first, node_tar = dim_curr_switch-> ext_wire[2].node_tar; - next_node = &pa_system_ptr-> + next_node = &ba_system_ptr-> grid [node_tar[X]] [node_tar[Y]] @@ -1611,16 +1611,16 @@ static int _find_yz_path(pa_node_t *pa_node, int *first, #endif /** */ -#ifdef HAVE_BGL -static int _create_config_even(pa_node_t ***grid) +#ifdef HAVE_BG +static int _create_config_even(ba_node_t ***grid) #else -static int _create_config_even(pa_node_t *grid) +static int _create_config_even(ba_node_t *grid) #endif { int x; - pa_node_t *source = NULL, *target = NULL; + ba_node_t *source = NULL, *target = NULL; -#ifdef HAVE_BGL +#ifdef HAVE_BG int y,z; init_wires(); @@ -1667,13 +1667,13 @@ static int _create_config_even(pa_node_t *grid) return 1; } -static int _reset_the_path(pa_switch_t *curr_switch, int source, +static int _reset_the_path(ba_switch_t *curr_switch, int source, int target, int dim) { int *node_tar; int *node_curr; int port_tar, port_tar1; - pa_switch_t *next_switch = NULL; + ba_switch_t *next_switch = NULL; /*set the switch to not be used */ curr_switch->int_wire[source].used = 0; @@ -1705,9 +1705,9 @@ static int _reset_the_path(pa_switch_t *curr_switch, int source, debug2("%d something bad happened!!", dim); return 0; } - next_switch = &pa_system_ptr-> + next_switch = &ba_system_ptr-> grid[node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif @@ -1746,11 +1746,11 @@ int _port_enum(int port) /** */ extern int set_bp_map(void) { -#ifdef HAVE_BGL_FILES - static rm_BGL_t *bgl = NULL; +#ifdef HAVE_BG_FILES + static rm_BGL_t *bg = NULL; int rc; rm_BP_t *my_bp = NULL; - pa_bp_map_t *bp_map = NULL; + ba_bp_map_t *bp_map = NULL; int bp_num, i, j; char *bp_id = NULL; rm_location_t bp_loc; @@ -1774,16 +1774,16 @@ extern int set_bp_map(void) return -1; } - if ((rc = rm_set_serial(BGL_SERIAL)) != STATUS_OK) { + if ((rc = rm_set_serial(BG_SERIAL)) != STATUS_OK) { error("rm_set_serial(): %d", rc); return -1; } - if ((rc = rm_get_BGL(&bgl)) != STATUS_OK) { + if ((rc = rm_get_BGL(&bg)) != STATUS_OK) { error("rm_get_BGL(): %d", rc); return -1; } - if ((rc = rm_get_data(bgl, RM_BPNum, &bp_num)) != STATUS_OK) { + if ((rc = rm_get_data(bg, RM_BPNum, &bp_num)) != STATUS_OK) { error("rm_get_data(RM_BPNum): %d", rc); bp_num = 0; } @@ -1791,20 +1791,20 @@ extern int set_bp_map(void) for (i=0; i<bp_num; i++) { if (i) { - if ((rc = rm_get_data(bgl, RM_NextBP, &my_bp)) + if ((rc = rm_get_data(bg, RM_NextBP, &my_bp)) != STATUS_OK) { error("rm_get_data(RM_NextBP): %d", rc); break; } } else { - if ((rc = rm_get_data(bgl, RM_FirstBP, &my_bp)) + if ((rc = rm_get_data(bg, RM_FirstBP, &my_bp)) != STATUS_OK) { error("rm_get_data(RM_FirstBP): %d", rc); break; } } - bp_map = (pa_bp_map_t *) xmalloc(sizeof(pa_bp_map_t)); + bp_map = (ba_bp_map_t *) xmalloc(sizeof(ba_bp_map_t)); if ((rc = rm_get_data(my_bp, RM_BPID, &bp_id)) != STATUS_OK) { @@ -1833,7 +1833,7 @@ extern int set_bp_map(void) if(DIM_SIZE[X] > bp_loc.X && DIM_SIZE[Y] > bp_loc.Y && DIM_SIZE[Z] > bp_loc.Z) - pa_system_ptr->grid + ba_system_ptr->grid [bp_loc.X] [bp_loc.Y] [bp_loc.Z].phys_x = number / 100; @@ -1843,7 +1843,7 @@ extern int set_bp_map(void) free(bp_id); } - if ((rc = rm_free_BGL(bgl)) != STATUS_OK) + if ((rc = rm_free_BGL(bg)) != STATUS_OK) error("rm_free_BGL(): %s", rc); #endif @@ -1852,91 +1852,91 @@ extern int set_bp_map(void) } -static void _new_pa_node(pa_node_t *pa_node, int *coord) +static void _new_ba_node(ba_node_t *ba_node, int *coord) { int i,j; - pa_node->used = false; + ba_node->used = false; - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++){ - pa_node->coord[i] = coord[i]; + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++){ + ba_node->coord[i] = coord[i]; for(j=0;j<NUM_PORTS_PER_NODE;j++) { - pa_node->axis_switch[i].int_wire[j].used = 0; + ba_node->axis_switch[i].int_wire[j].used = 0; if(i!=X) { if(j==3 || j==4) - pa_node->axis_switch[i].int_wire[j]. + ba_node->axis_switch[i].int_wire[j]. used = 1; } - pa_node->axis_switch[i].int_wire[j].port_tar = j; + ba_node->axis_switch[i].int_wire[j].port_tar = j; } } } -static void _create_pa_system(void) +static void _create_ba_system(void) { int x; - int coord[PA_SYSTEM_DIMENSIONS]; + int coord[BA_SYSTEM_DIMENSIONS]; -#ifdef HAVE_BGL +#ifdef HAVE_BG int y,z; - pa_system_ptr->grid = (pa_node_t***) - xmalloc(sizeof(pa_node_t**) * DIM_SIZE[X]); + ba_system_ptr->grid = (ba_node_t***) + xmalloc(sizeof(ba_node_t**) * DIM_SIZE[X]); #else - pa_system_ptr->grid = (pa_node_t*) - xmalloc(sizeof(pa_node_t) * DIM_SIZE[X]); + ba_system_ptr->grid = (ba_node_t*) + xmalloc(sizeof(ba_node_t) * DIM_SIZE[X]); #endif for (x=0; x<DIM_SIZE[X]; x++) { -#ifdef HAVE_BGL - pa_system_ptr->grid[x] = (pa_node_t**) - xmalloc(sizeof(pa_node_t*) * DIM_SIZE[Y]); +#ifdef HAVE_BG + ba_system_ptr->grid[x] = (ba_node_t**) + xmalloc(sizeof(ba_node_t*) * DIM_SIZE[Y]); for (y=0; y<DIM_SIZE[Y]; y++) { - pa_system_ptr->grid[x][y] = (pa_node_t*) - xmalloc(sizeof(pa_node_t) * DIM_SIZE[Z]); + ba_system_ptr->grid[x][y] = (ba_node_t*) + xmalloc(sizeof(ba_node_t) * DIM_SIZE[Z]); for (z=0; z<DIM_SIZE[Z]; z++){ coord[X] = x; coord[Y] = y; coord[Z] = z; - _new_pa_node(&pa_system_ptr->grid[x][y][z], + _new_ba_node(&ba_system_ptr->grid[x][y][z], coord); } } #else coord[X] = x; - _new_pa_node(&pa_system_ptr->grid[x], coord); + _new_ba_node(&ba_system_ptr->grid[x], coord); #endif } } /** */ -static void _delete_pa_system(void) +static void _delete_ba_system(void) { -#ifdef HAVE_BGL +#ifdef HAVE_BG int x=0; int y; #endif - if (!pa_system_ptr){ + if (!ba_system_ptr){ return; } - if(pa_system_ptr->grid) { -#ifdef HAVE_BGL + if(ba_system_ptr->grid) { +#ifdef HAVE_BG for (x=0; x<DIM_SIZE[X]; x++) { for (y=0; y<DIM_SIZE[Y]; y++) - xfree(pa_system_ptr->grid[x][y]); + xfree(ba_system_ptr->grid[x][y]); - xfree(pa_system_ptr->grid[x]); + xfree(ba_system_ptr->grid[x]); } #endif - xfree(pa_system_ptr->grid); + xfree(ba_system_ptr->grid); } - xfree(pa_system_ptr); + xfree(ba_system_ptr); } static void _delete_path_list(void *object) { - pa_path_switch_t *path_switch = (pa_path_switch_t *)object; + ba_path_switch_t *path_switch = (ba_path_switch_t *)object; if (path_switch) { xfree(path_switch); @@ -1947,41 +1947,41 @@ static void _delete_path_list(void *object) /** * algorithm for finding match */ -static int _find_match(pa_request_t *pa_request, List results) +static int _find_match(ba_request_t *ba_request, List results) { int x=0; -#ifdef HAVE_BGL - int start[PA_SYSTEM_DIMENSIONS] = {0,0,0}; +#ifdef HAVE_BG + int start[BA_SYSTEM_DIMENSIONS] = {0,0,0}; #else - int start[PA_SYSTEM_DIMENSIONS] = {0}; + int start[BA_SYSTEM_DIMENSIONS] = {0}; #endif - pa_node_t *pa_node = NULL; + ba_node_t *ba_node = NULL; char *name=NULL; int startx = (start[X]-1); if(startx == -1) startx = DIM_SIZE[X]-1; - if(pa_request->start_req) { - if(pa_request->start[X]>DIM_SIZE[X] -#ifdef HAVE_BGL - || pa_request->start[Y]>DIM_SIZE[Y] - || pa_request->start[Z]>DIM_SIZE[Z] + if(ba_request->start_req) { + if(ba_request->start[X]>DIM_SIZE[X] +#ifdef HAVE_BG + || ba_request->start[Y]>DIM_SIZE[Y] + || ba_request->start[Z]>DIM_SIZE[Z] #endif ) return 0; - for(x=0;x<PA_SYSTEM_DIMENSIONS;x++) { - start[x] = pa_request->start[x]; + for(x=0;x<BA_SYSTEM_DIMENSIONS;x++) { + start[x] = ba_request->start[x]; } } x=0; - if(pa_request->geometry[X]>DIM_SIZE[X] -#ifdef HAVE_BGL - || pa_request->geometry[Y]>DIM_SIZE[Y] - || pa_request->geometry[Z]>DIM_SIZE[Z] + if(ba_request->geometry[X]>DIM_SIZE[X] +#ifdef HAVE_BG + || ba_request->geometry[Y]>DIM_SIZE[Y] + || ba_request->geometry[Z]>DIM_SIZE[Z] #endif ) -#ifdef HAVE_BGL - if(!_check_for_options(pa_request)) +#ifdef HAVE_BG + if(!_check_for_options(ba_request)) #endif return 0; @@ -1992,68 +1992,68 @@ start_again: while(x!=startx) { x++; debug3("finding %d%d%d try %d", - pa_request->geometry[X], -#ifdef HAVE_BGL - pa_request->geometry[Y], - pa_request->geometry[Z], + ba_request->geometry[X], +#ifdef HAVE_BG + ba_request->geometry[Y], + ba_request->geometry[Z], #endif x); new_node: debug("starting at %d%d%d", start[X] -#ifdef HAVE_BGL +#ifdef HAVE_BG , start[Y], start[Z] #endif ); - pa_node = &pa_system_ptr-> + ba_node = &ba_system_ptr-> grid[start[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [start[Y]] [start[Z]] #endif ; - if (!_node_used(pa_node, pa_request->geometry)) { - name = set_bgl_part(results, + if (!_node_used(ba_node, ba_request->geometry)) { + name = set_bg_block(results, start, - pa_request->geometry, - pa_request->conn_type); + ba_request->geometry, + ba_request->conn_type); if(name) { - pa_request->save_name = xstrdup(name); + ba_request->save_name = xstrdup(name); xfree(name); return 1; } - if(pa_request->start_req) + if(ba_request->start_req) goto requested_end; //exit(0); debug("trying something else"); - remove_part(results, color_count); + remove_block(results, color_count); list_destroy(results); results = list_create(NULL); } -#ifdef HAVE_BGL +#ifdef HAVE_BG if((DIM_SIZE[Z]-start[Z]-1) - >= pa_request->geometry[Z]) + >= ba_request->geometry[Z]) start[Z]++; else { start[Z] = 0; if((DIM_SIZE[Y]-start[Y]-1) - >= pa_request->geometry[Y]) + >= ba_request->geometry[Y]) start[Y]++; else { start[Y] = 0; if ((DIM_SIZE[X]-start[X]-1) - >= pa_request->geometry[X]) + >= ba_request->geometry[X]) start[X]++; else { - if(!_check_for_options(pa_request)) + if(!_check_for_options(ba_request)) return 0; else { start[X]=0; -#ifdef HAVE_BGL +#ifdef HAVE_BG start[Y]=0; start[Z]=0; #endif @@ -2071,25 +2071,25 @@ requested_end: return 0; } -/* bool _node_used(pa_node_t* pa_node, int geometry, */ -static bool _node_used(pa_node_t* pa_node, int *geometry) +/* bool _node_used(ba_node_t* ba_node, int geometry, */ +static bool _node_used(ba_node_t* ba_node, int *geometry) { int i=0; - pa_switch_t* pa_switch = NULL; + ba_switch_t* ba_switch = NULL; - /* if we've used this node in another partition already */ - if (!pa_node || pa_node->used) { + /* if we've used this node in another block already */ + if (!ba_node || ba_node->used) { debug3("node used"); return true; } /* if we've used this nodes switches completely in another - partition already */ + block already */ for(i=0;i<1;i++) { if(geometry[i]>1) { - pa_switch = &pa_node->axis_switch[i]; + ba_switch = &ba_node->axis_switch[i]; - if(pa_switch->int_wire[3].used - && pa_switch->int_wire[5].used) { + if(ba_switch->int_wire[3].used + && ba_switch->int_wire[5].used) { debug3("switch in use dim %d!",i); return true; } @@ -2101,10 +2101,10 @@ static bool _node_used(pa_node_t* pa_node, int *geometry) } -static void _switch_config(pa_node_t* source, pa_node_t* target, int dim, +static void _switch_config(ba_node_t* source, ba_node_t* target, int dim, int port_src, int port_tar) { - pa_switch_t* config = NULL, *config_tar = NULL; + ba_switch_t* config = NULL, *config_tar = NULL; int i; if (!source || !target) @@ -2112,7 +2112,7 @@ static void _switch_config(pa_node_t* source, pa_node_t* target, int dim, config = &source->axis_switch[dim]; config_tar = &target->axis_switch[dim]; - for(i=0;i<PA_SYSTEM_DIMENSIONS;i++) { + for(i=0;i<BA_SYSTEM_DIMENSIONS;i++) { /* Set the coord of the source target node to the target */ config->ext_wire[port_src].node_tar[i] = target->coord[i]; @@ -2127,11 +2127,11 @@ static void _switch_config(pa_node_t* source, pa_node_t* target, int dim, config_tar->ext_wire[port_tar].port_tar = port_src; } -static int _set_external_wires(int dim, int count, pa_node_t* source, - pa_node_t* target) +static int _set_external_wires(int dim, int count, ba_node_t* source, + ba_node_t* target) { -#ifdef HAVE_BGL_FILES - rm_BGL_t *bgl = NULL; +#ifdef HAVE_BG_FILES + rm_BGL_t *bg = NULL; int rc; int i; rm_wire_t *my_wire = NULL; @@ -2147,19 +2147,19 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, error("Can't access DB2 library, run from service node"); return -1; } - if ((rc = rm_set_serial(BGL_SERIAL)) != STATUS_OK) { - error("rm_set_serial(%s): %d", BGL_SERIAL, rc); + if ((rc = rm_set_serial(BG_SERIAL)) != STATUS_OK) { + error("rm_set_serial(%s): %d", BG_SERIAL, rc); return -1; } - if ((rc = rm_get_BGL(&bgl)) != STATUS_OK) { + if ((rc = rm_get_BGL(&bg)) != STATUS_OK) { error("rm_get_BGL(): %d", rc); return -1; } - if (bgl == NULL) + if (bg == NULL) return -1; - if ((rc = rm_get_data(bgl, RM_WireNum, &wire_num)) != STATUS_OK) { + if ((rc = rm_get_data(bg, RM_WireNum, &wire_num)) != STATUS_OK) { error("rm_get_data(RM_BPNum): %d", rc); wire_num = 0; } @@ -2168,13 +2168,13 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, for (i=0; i<wire_num; i++) { if (i) { - if ((rc = rm_get_data(bgl, RM_NextWire, &my_wire)) + if ((rc = rm_get_data(bg, RM_NextWire, &my_wire)) != STATUS_OK) { error("rm_get_data(RM_NextWire): %d", rc); break; } } else { - if ((rc = rm_get_data(bgl, RM_FirstWire, &my_wire)) + if ((rc = rm_get_data(bg, RM_FirstWire, &my_wire)) != STATUS_OK) { error("rm_get_data(RM_FirstWire): %d", rc); break; @@ -2250,7 +2250,7 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, DIM_SIZE[Z]); continue; } - source = &pa_system_ptr-> + source = &ba_system_ptr-> grid[coord[X]][coord[Y]][coord[Z]]; coord = find_bp_loc(to_node); if(coord[X]>=DIM_SIZE[X] @@ -2266,7 +2266,7 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, DIM_SIZE[Z]); continue; } - target = &pa_system_ptr-> + target = &ba_system_ptr-> grid[coord[X]][coord[Y]][coord[Z]]; _switch_config(source, target, @@ -2282,7 +2282,7 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, _port_enum(to_port)); } - if ((rc = rm_free_BGL(bgl)) != STATUS_OK) + if ((rc = rm_free_BGL(bg)) != STATUS_OK) error("rm_free_BGL(): %s", rc); #else @@ -2299,9 +2299,9 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, it will go to the first.*/ -#ifdef HAVE_BGL +#ifdef HAVE_BG #if 0 - /* this is here for the second half of bgl system. + /* this is here for the second half of bg system. if used it should be changed to #if 1 */ if(count == 0) { @@ -2311,7 +2311,7 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, _switch_config(source, target, dim, 4, 3); /* 2 not in use */ _switch_config(source, source, dim, 2, 2); - target = &pa_system_ptr->grid[DIM_SIZE[X]-1] + target = &ba_system_ptr->grid[DIM_SIZE[X]-1] [source->coord[Y]] [source->coord[Z]]; @@ -2353,7 +2353,7 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, } else if(count == 2) { /* 2nd Node */ /* make sure target is the last node */ - target = &pa_system_ptr->grid[DIM_SIZE[X]-1] + target = &ba_system_ptr->grid[DIM_SIZE[X]-1] [source->coord[Y]] [source->coord[Z]]; /* 3->4 of last */ @@ -2363,7 +2363,7 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, } else if(count == 3) { /* 3rd Node */ /* make sure target is the next to last node */ - target = &pa_system_ptr->grid[DIM_SIZE[X]-2] + target = &ba_system_ptr->grid[DIM_SIZE[X]-2] [source->coord[Y]] [source->coord[Z]]; /* 3->4 of next to last */ @@ -2383,7 +2383,7 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, _switch_config(source, source, dim, 5, 5); } } else if(DIM_SIZE[X] != 8) { - fatal("Do don't have a config to do this BGL system."); + fatal("Do don't have a config to do this BG system."); } #else if(count == 0) @@ -2394,14 +2394,14 @@ static int _set_external_wires(int dim, int count, pa_node_t* source, _switch_config(source, source, dim, 2, 2); _switch_config(source, source, dim, 3, 3); _switch_config(source, source, dim, 4, 4); -#endif /* HAVE_BGL */ -#endif /* HAVE_BGL_FILES */ +#endif /* HAVE_BG */ +#endif /* HAVE_BG_FILES */ return 1; } static char *_set_internal_wires(List nodes, int size, int conn_type) { - pa_node_t* pa_node[size+1]; + ba_node_t* ba_node[size+1]; int count=0, i, set=0; int *start = NULL; int *end = NULL; @@ -2412,11 +2412,11 @@ static char *_set_internal_wires(List nodes, int size, int conn_type) if(!nodes) return NULL; itr = list_iterator_create(nodes); - while((pa_node[count] = (pa_node_t*) list_next(itr))) { - sprintf(name, "bgl%d%d%d\0", - pa_node[count]->coord[X], - pa_node[count]->coord[Y], - pa_node[count]->coord[Z]); + while((ba_node[count] = (ba_node_t*) list_next(itr))) { + sprintf(name, "%d%d%d\0", + ba_node[count]->coord[X], + ba_node[count]->coord[Y], + ba_node[count]->coord[Z]); debug3("name = %s",name); count++; hostlist_push(hostlist, name); @@ -2424,29 +2424,29 @@ static char *_set_internal_wires(List nodes, int size, int conn_type) } list_iterator_destroy(itr); - start = pa_node[0]->coord; - end = pa_node[count-1]->coord; + start = ba_node[0]->coord; + end = ba_node[count-1]->coord; hostlist_ranged_string(hostlist, BUFSIZE, name); hostlist_destroy(hostlist); for(i=0;i<count;i++) { - if(!pa_node[i]->used) { - pa_node[i]->used=1; - pa_node[i]->conn_type=conn_type; - if(pa_node[i]->letter == '.') { - pa_node[i]->letter = letters[color_count%62]; - pa_node[i]->color = colors[color_count%6]; + if(!ba_node[i]->used) { + ba_node[i]->used=1; + ba_node[i]->conn_type=conn_type; + if(ba_node[i]->letter == '.') { + ba_node[i]->letter = letters[color_count%62]; + ba_node[i]->color = colors[color_count%6]; debug3("count %d setting letter = %c " "color = %d", color_count, - pa_node[i]->letter, - pa_node[i]->color); + ba_node[i]->letter, + ba_node[i]->color); set=1; } } else { - error("No network connection to create bglblock " + error("No network connection to create bgblock " "containing %s", name); - error("Use smap to define bglblocks in bluegene.conf"); + error("Use smap to define bgblocks in bluegene.conf"); xfree(name); return NULL; } @@ -2454,7 +2454,7 @@ static char *_set_internal_wires(List nodes, int size, int conn_type) if(conn_type == TORUS) for(i=0;i<count;i++) { - _set_one_dim(start, end, pa_node[i]->coord); + _set_one_dim(start, end, ba_node[i]->coord); } if(set) @@ -2463,12 +2463,12 @@ static char *_set_internal_wires(List nodes, int size, int conn_type) return name; } -static int _find_x_path(List results, pa_node_t *pa_node, +static int _find_x_path(List results, ba_node_t *ba_node, int *start, int *first, int *geometry, int found, int conn_type) { - pa_switch_t *curr_switch = NULL; - pa_switch_t *next_switch = NULL; + ba_switch_t *curr_switch = NULL; + ba_switch_t *next_switch = NULL; int port_tar; int source_port=0; @@ -2478,14 +2478,14 @@ static int _find_x_path(List results, pa_node_t *pa_node, int ports_to_try[2] = {3,5}; int *node_tar = NULL; int i, i2; - pa_node_t *next_node = NULL; - pa_node_t *check_node = NULL; + ba_node_t *next_node = NULL; + ba_node_t *check_node = NULL; int highest_phys_x = geometry[X] - start[X]; ListIterator itr; List path = NULL; - if(!pa_node) + if(!ba_node) return 0; if(!source_port) { @@ -2494,7 +2494,7 @@ static int _find_x_path(List results, pa_node_t *pa_node, ports_to_try[1] = 2; } - curr_switch = &pa_node->axis_switch[X]; + curr_switch = &ba_node->axis_switch[X]; if(geometry[X] == 1) { goto found_one; } @@ -2510,7 +2510,7 @@ static int _find_x_path(List results, pa_node_t *pa_node, ext_wire[ports_to_try[i]].port_tar; /* check to see if we are back at the start of the - partition */ + block */ if((node_tar[X] == start[X] && node_tar[Y] == @@ -2522,17 +2522,17 @@ static int _find_x_path(List results, pa_node_t *pa_node, } /* check to see if the port points to itself */ if((node_tar[X] == - pa_node->coord[X] && + ba_node->coord[X] && node_tar[Y] == - pa_node->coord[Y] && + ba_node->coord[Y] && node_tar[Z] == - pa_node->coord[Z])) { + ba_node->coord[Z])) { continue; } /* check to see if I am going to a place I have already been before */ itr = list_iterator_create(results); - while((next_node = (pa_node_t*) list_next(itr))) { + while((next_node = (ba_node_t*) list_next(itr))) { debug3("looking at %d%d%d and %d%d%d", next_node->coord[X], next_node->coord[Y], @@ -2559,9 +2559,9 @@ static int _find_x_path(List results, pa_node_t *pa_node, not_first = 0; broke_it: - next_node = &pa_system_ptr-> + next_node = &ba_system_ptr-> grid[node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif @@ -2590,9 +2590,9 @@ static int _find_x_path(List results, pa_node_t *pa_node, debug2("yes found next free %d", best_count); node_tar = _set_best_path(); - next_node = &pa_system_ptr-> + next_node = &ba_system_ptr-> grid[node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif @@ -2600,13 +2600,13 @@ static int _find_x_path(List results, pa_node_t *pa_node, next_switch = &next_node->axis_switch[X]; -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("found %d looking at " "%d%d%d going to %d%d%d %d", found, - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z], + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z], node_tar[X], node_tar[Y], node_tar[Z], @@ -2655,13 +2655,13 @@ static int _find_x_path(List results, pa_node_t *pa_node, } if (!_node_used(next_node, geometry)) { -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("found %d looking at %d%d%d " "%d going to %d%d%d %d", found, - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z], + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z], ports_to_try[i], node_tar[X], node_tar[Y], @@ -2670,7 +2670,7 @@ static int _find_x_path(List results, pa_node_t *pa_node, #endif itr = list_iterator_create(results); while((check_node = - (pa_node_t*) list_next(itr))) { + (ba_node_t*) list_next(itr))) { if((node_tar[X] == check_node->coord[X] && node_tar[Y] == @@ -2682,7 +2682,7 @@ static int _find_x_path(List results, pa_node_t *pa_node, } list_iterator_destroy(itr); if(!check_node) { -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("add %d%d%d", next_node->coord[X], next_node->coord[Y], @@ -2690,7 +2690,7 @@ static int _find_x_path(List results, pa_node_t *pa_node, #endif list_append(results, next_node); } else { -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("Hey this is already added " "%d%d%d", node_tar[X], @@ -2710,12 +2710,12 @@ static int _find_x_path(List results, pa_node_t *pa_node, continue; } else { found_path: -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("added node %d%d%d %d %d -> " "%d%d%d %d %d", - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z], + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z], source_port, ports_to_try[i], node_tar[X], @@ -2768,12 +2768,12 @@ static int _find_x_path(List results, pa_node_t *pa_node, return 0; } -static int _find_x_path2(List results, pa_node_t *pa_node, +static int _find_x_path2(List results, ba_node_t *ba_node, int *start, int *first, int *geometry, int found, int conn_type) { -pa_switch_t *curr_switch = NULL; -pa_switch_t *next_switch = NULL; +ba_switch_t *curr_switch = NULL; +ba_switch_t *next_switch = NULL; int port_tar; int source_port=0; @@ -2783,13 +2783,13 @@ int port_tar; int ports_to_try[2] = {3,5}; int *node_tar = NULL; int i, i2; - pa_node_t *next_node = NULL; - pa_node_t *check_node = NULL; + ba_node_t *next_node = NULL; + ba_node_t *check_node = NULL; ListIterator itr; List path = NULL; - if(!pa_node) + if(!ba_node) return 0; if(!source_port) { @@ -2798,7 +2798,7 @@ int port_tar; ports_to_try[1] = 4; } - curr_switch = &pa_node->axis_switch[X]; + curr_switch = &ba_node->axis_switch[X]; if(geometry[X] == 1) { goto found_one; } @@ -2820,15 +2820,15 @@ int port_tar; goto broke_it; } if((node_tar[X] == - pa_node->coord[X] && + ba_node->coord[X] && node_tar[Y] == - pa_node->coord[Y] && + ba_node->coord[Y] && node_tar[Z] == - pa_node->coord[Z])) { + ba_node->coord[Z])) { continue; } itr = list_iterator_create(results); - while((next_node = (pa_node_t*) list_next(itr))) { + while((next_node = (ba_node_t*) list_next(itr))) { if((node_tar[X] == next_node->coord[X] && node_tar[Y] == @@ -2848,11 +2848,11 @@ int port_tar; not_first = 0; broke_it: -#ifdef HAVE_BGL - next_node = &pa_system_ptr-> +#ifdef HAVE_BG + next_node = &ba_system_ptr-> grid[node_tar[X]][node_tar[Y]][node_tar[Z]]; #else - next_node = &pa_system_ptr-> + next_node = &ba_system_ptr-> grid[node_tar[X]]; #endif next_switch = &next_node->axis_switch[X]; @@ -2890,13 +2890,13 @@ int port_tar; } if (!_node_used(next_node, geometry)) { -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("found %d looking at %d%d%d " "%d going to %d%d%d %d", found, - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z], + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z], ports_to_try[i], node_tar[X], node_tar[Y], @@ -2905,7 +2905,7 @@ int port_tar; #endif itr = list_iterator_create(results); while((check_node = - (pa_node_t*) list_next(itr))) { + (ba_node_t*) list_next(itr))) { if((node_tar[X] == check_node->coord[X] && node_tar[Y] == @@ -2917,7 +2917,7 @@ int port_tar; } list_iterator_destroy(itr); if(!check_node) { -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("add %d%d%d", next_node->coord[X], next_node->coord[Y], @@ -2925,7 +2925,7 @@ int port_tar; #endif list_append(results, next_node); } else { -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("Hey this is already added " "%d%d%d", node_tar[X], @@ -2945,12 +2945,12 @@ int port_tar; continue; } else { found_path: -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("added node %d%d%d %d %d -> " "%d%d%d %d %d", - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z], + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z], source_port, ports_to_try[i], node_tar[X], @@ -2998,11 +2998,11 @@ int port_tar; } } } -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("looking for the next free node starting at %d%d%d", - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z]); + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z]); #endif list_destroy(best_path); @@ -3017,21 +3017,21 @@ int port_tar; if(best_count < BEST_COUNT_INIT) { debug2("yes found next free %d", best_count); node_tar = _set_best_path(); -#ifdef HAVE_BGL - next_node = &pa_system_ptr-> +#ifdef HAVE_BG + next_node = &ba_system_ptr-> grid[node_tar[X]][node_tar[Y]][node_tar[Z]]; #else - next_node = &pa_system_ptr-> + next_node = &ba_system_ptr-> grid[node_tar[X]]; #endif next_switch = &next_node->axis_switch[X]; -#ifdef HAVE_BGL +#ifdef HAVE_BG debug2("found %d looking at %d%d%d going to %d%d%d %d", found, - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z], + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z], node_tar[X], node_tar[Y], node_tar[Z], @@ -3057,15 +3057,15 @@ int port_tar; static int _remove_node(List results, int *node_tar) { ListIterator itr; - pa_node_t *pa_node = NULL; + ba_node_t *ba_node = NULL; itr = list_iterator_create(results); - while((pa_node = (pa_node_t*) list_next(itr))) { + while((ba_node = (ba_node_t*) list_next(itr))) { -#ifdef HAVE_BGL - if(node_tar[X] == pa_node->coord[X] - && node_tar[Y] == pa_node->coord[Y] - && node_tar[Z] == pa_node->coord[Z]) { +#ifdef HAVE_BG + if(node_tar[X] == ba_node->coord[X] + && node_tar[Y] == ba_node->coord[Y] + && node_tar[Z] == ba_node->coord[Z]) { debug2("removing %d%d%d from list", node_tar[X], node_tar[Y], @@ -3074,7 +3074,7 @@ static int _remove_node(List results, int *node_tar) break; } #else - if(node_tar[X] == pa_node->coord[X]) { + if(node_tar[X] == ba_node->coord[X]) { debug2("removing %d from list", node_tar[X]); list_remove (itr); @@ -3086,17 +3086,17 @@ static int _remove_node(List results, int *node_tar) return 1; } -static int _find_next_free_using_port_2(pa_switch_t *curr_switch, +static int _find_next_free_using_port_2(ba_switch_t *curr_switch, int source_port, List nodes, int dim, int count) { - pa_switch_t *next_switch = NULL; - pa_path_switch_t *path_add = - (pa_path_switch_t *) xmalloc(sizeof(pa_path_switch_t)); - pa_path_switch_t *path_switch = NULL; - pa_path_switch_t *temp_switch = NULL; + ba_switch_t *next_switch = NULL; + ba_path_switch_t *path_add = + (ba_path_switch_t *) xmalloc(sizeof(ba_path_switch_t)); + ba_path_switch_t *path_switch = NULL; + ba_path_switch_t *temp_switch = NULL; int port_tar; int target_port = 0; int port_to_try = 2; @@ -3105,13 +3105,13 @@ static int _find_next_free_using_port_2(pa_switch_t *curr_switch, int i; int used=0; int broke = 0; - pa_node_t *pa_node = NULL; + ba_node_t *ba_node = NULL; ListIterator itr; static bool found = false; path_add->geometry[X] = node_src[X]; -#ifdef HAVE_BGL +#ifdef HAVE_BG path_add->geometry[Y] = node_src[Y]; path_add->geometry[Z] = node_src[Z]; #endif @@ -3122,12 +3122,12 @@ static int _find_next_free_using_port_2(pa_switch_t *curr_switch, goto return_0; itr = list_iterator_create(nodes); - while((pa_node = (pa_node_t*) list_next(itr))) { + while((ba_node = (ba_node_t*) list_next(itr))) { - if(node_tar[X] == pa_node->coord[X] -#ifdef HAVE_BGL - && node_tar[Y] == pa_node->coord[Y] - && node_tar[Z] == pa_node->coord[Z] + if(node_tar[X] == ba_node->coord[X] +#ifdef HAVE_BG + && node_tar[Y] == ba_node->coord[Y] + && node_tar[Z] == ba_node->coord[Z] #endif ) { @@ -3138,8 +3138,8 @@ static int _find_next_free_using_port_2(pa_switch_t *curr_switch, list_iterator_destroy(itr); if(!broke && count>0 && - !pa_system_ptr->grid[node_tar[X]] -#ifdef HAVE_BGL + !ba_system_ptr->grid[node_tar[X]] +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif @@ -3162,13 +3162,13 @@ static int _find_next_free_using_port_2(pa_switch_t *curr_switch, list_push(path, path_add); itr = list_iterator_create(path); - while((path_switch = (pa_path_switch_t*) list_next(itr))){ + while((path_switch = (ba_path_switch_t*) list_next(itr))){ - temp_switch = (pa_path_switch_t *) - xmalloc(sizeof(pa_path_switch_t)); + temp_switch = (ba_path_switch_t *) + xmalloc(sizeof(ba_path_switch_t)); temp_switch->geometry[X] = path_switch->geometry[X]; -#ifdef HAVE_BGL +#ifdef HAVE_BG temp_switch->geometry[Y] = path_switch->geometry[Y]; temp_switch->geometry[Z] = path_switch->geometry[Z]; #endif @@ -3186,10 +3186,10 @@ static int _find_next_free_using_port_2(pa_switch_t *curr_switch, if(!curr_switch->int_wire[port_to_try].used) { itr = list_iterator_create(path); while((path_switch = - (pa_path_switch_t*) list_next(itr))){ + (ba_path_switch_t*) list_next(itr))){ if(((path_switch->geometry[X] == node_src[X]) -#ifdef HAVE_BGL +#ifdef HAVE_BG && (path_switch->geometry[Y] == node_src[Y]) && (path_switch->geometry[Z] @@ -3209,7 +3209,7 @@ static int _find_next_free_using_port_2(pa_switch_t *curr_switch, if(curr_switch-> ext_wire[port_to_try].node_tar[X] == curr_switch->ext_wire[0].node_tar[X] -#ifdef HAVE_BGL +#ifdef HAVE_BG && curr_switch-> ext_wire[port_to_try].node_tar[Y] == curr_switch->ext_wire[0].node_tar[Y] @@ -3227,9 +3227,9 @@ static int _find_next_free_using_port_2(pa_switch_t *curr_switch, node_tar = curr_switch-> ext_wire[port_to_try].node_tar; - next_switch = &pa_system_ptr-> + next_switch = &ba_system_ptr-> grid[node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif @@ -3250,14 +3250,14 @@ return_0: return 0; } -static int _find_passthrough(pa_switch_t *curr_switch, int source_port, +static int _find_passthrough(ba_switch_t *curr_switch, int source_port, List nodes, int dim, int count, int highest_phys_x) { - pa_switch_t *next_switch = NULL; - pa_path_switch_t *path_add = - (pa_path_switch_t *) xmalloc(sizeof(pa_path_switch_t)); - pa_path_switch_t *path_switch = NULL; - pa_path_switch_t *temp_switch = NULL; + ba_switch_t *next_switch = NULL; + ba_path_switch_t *path_add = + (ba_path_switch_t *) xmalloc(sizeof(ba_path_switch_t)); + ba_path_switch_t *path_switch = NULL; + ba_path_switch_t *temp_switch = NULL; int port_tar; int target_port = 0; int ports_to_try[2] = {3,5}; @@ -3266,13 +3266,13 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, int i; int used=0; int broke = 0; - pa_node_t *pa_node = NULL; + ba_node_t *ba_node = NULL; ListIterator itr; static bool found = false; path_add->geometry[X] = node_src[X]; -#ifdef HAVE_BGL +#ifdef HAVE_BG path_add->geometry[Y] = node_src[Y]; path_add->geometry[Z] = node_src[Z]; #endif @@ -3284,17 +3284,17 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, } itr = list_iterator_create(nodes); - while((pa_node = (pa_node_t*) list_next(itr))) { + while((ba_node = (ba_node_t*) list_next(itr))) { -#ifdef HAVE_BGL - if(node_tar[X] == pa_node->coord[X] - && node_tar[Y] == pa_node->coord[Y] - && node_tar[Z] == pa_node->coord[Z]) { +#ifdef HAVE_BG + if(node_tar[X] == ba_node->coord[X] + && node_tar[Y] == ba_node->coord[Y] + && node_tar[Z] == ba_node->coord[Z]) { broke = 1; break; } #else - if(node_tar[X] == pa_node->coord[X]) { + if(node_tar[X] == ba_node->coord[X]) { broke = 1; break; } @@ -3302,16 +3302,16 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, } list_iterator_destroy(itr); - pa_node = &pa_system_ptr-> + ba_node = &ba_system_ptr-> grid[node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif ; if(!broke && count>0 - && !pa_node->used - && (pa_node->phys_x < highest_phys_x)) { + && !ba_node->used + && (ba_node->phys_x < highest_phys_x)) { debug3("this one not found %d%d%d", node_tar[X], @@ -3330,13 +3330,13 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, list_push(path, path_add); itr = list_iterator_create(path); - while((path_switch = (pa_path_switch_t*) list_next(itr))){ + while((path_switch = (ba_path_switch_t*) list_next(itr))){ - temp_switch = (pa_path_switch_t *) - xmalloc(sizeof(pa_path_switch_t)); + temp_switch = (ba_path_switch_t *) + xmalloc(sizeof(ba_path_switch_t)); temp_switch->geometry[X] = path_switch->geometry[X]; -#ifdef HAVE_BGL +#ifdef HAVE_BG temp_switch->geometry[Y] = path_switch->geometry[Y]; temp_switch->geometry[Z] = path_switch->geometry[Z]; #endif @@ -3365,10 +3365,10 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, if(!curr_switch->int_wire[ports_to_try[i]].used) { itr = list_iterator_create(path); while((path_switch = - (pa_path_switch_t*) list_next(itr))){ + (ba_path_switch_t*) list_next(itr))){ if(((path_switch->geometry[X] == node_src[X]) -#ifdef HAVE_BGL +#ifdef HAVE_BG && (path_switch->geometry[Y] == node_src[Y]) && (path_switch->geometry[Z] @@ -3388,7 +3388,7 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, if(curr_switch-> ext_wire[ports_to_try[i]].node_tar[X] == curr_switch->ext_wire[0].node_tar[X] -#ifdef HAVE_BGL +#ifdef HAVE_BG && curr_switch-> ext_wire[ports_to_try[i]].node_tar[Y] == curr_switch->ext_wire[0].node_tar[Y] @@ -3406,9 +3406,9 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, node_tar = curr_switch-> ext_wire[ports_to_try[i]].node_tar; - next_switch = &pa_system_ptr-> + next_switch = &ba_system_ptr-> grid[node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif @@ -3419,9 +3419,9 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, list_push(path, path_add); debug3("looking at this one " "%d%d%d %d -> %d%d%d %d", - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z], + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z], ports_to_try[i], node_tar[X], node_tar[Y], @@ -3439,14 +3439,14 @@ static int _find_passthrough(pa_switch_t *curr_switch, int source_port, return 0; } -static int _finish_torus(pa_switch_t *curr_switch, int source_port, +static int _finish_torus(ba_switch_t *curr_switch, int source_port, List nodes, int dim, int count, int *start) { - pa_switch_t *next_switch = NULL; - pa_path_switch_t *path_add = - (pa_path_switch_t *) xmalloc(sizeof(pa_path_switch_t)); - pa_path_switch_t *path_switch = NULL; - pa_path_switch_t *temp_switch = NULL; + ba_switch_t *next_switch = NULL; + ba_path_switch_t *path_add = + (ba_path_switch_t *) xmalloc(sizeof(ba_path_switch_t)); + ba_path_switch_t *path_switch = NULL; + ba_path_switch_t *temp_switch = NULL; int port_tar; int target_port=0; int ports_to_try[2] = {3,5}; @@ -3454,12 +3454,12 @@ static int _finish_torus(pa_switch_t *curr_switch, int source_port, int *node_src = curr_switch->ext_wire[0].node_tar; int i; int used=0; - pa_node_t *pa_node = NULL; + ba_node_t *ba_node = NULL; ListIterator itr; static bool found = false; path_add->geometry[X] = node_src[X]; -#ifdef HAVE_BGL +#ifdef HAVE_BG path_add->geometry[Y] = node_src[Y]; path_add->geometry[Z] = node_src[Z]; #endif @@ -3470,7 +3470,7 @@ static int _finish_torus(pa_switch_t *curr_switch, int source_port, return 0; if(node_tar[X] == start[X] -#ifdef HAVE_BGL +#ifdef HAVE_BG && node_tar[Y] == start[Y] && node_tar[Z] == start[Z] #endif @@ -3488,14 +3488,14 @@ static int _finish_torus(pa_switch_t *curr_switch, int source_port, itr = list_iterator_create(path); while((path_switch = - (pa_path_switch_t*) list_next(itr))){ + (ba_path_switch_t*) list_next(itr))){ - temp_switch = (pa_path_switch_t *) - xmalloc(sizeof(pa_path_switch_t)); + temp_switch = (ba_path_switch_t *) + xmalloc(sizeof(ba_path_switch_t)); temp_switch->geometry[X] = path_switch->geometry[X]; -#ifdef HAVE_BGL +#ifdef HAVE_BG temp_switch->geometry[Y] = path_switch->geometry[Y]; temp_switch->geometry[Z] = @@ -3522,10 +3522,10 @@ static int _finish_torus(pa_switch_t *curr_switch, int source_port, if(!curr_switch->int_wire[ports_to_try[i]].used) { itr = list_iterator_create(path); while((path_switch = - (pa_path_switch_t*) list_next(itr))){ + (ba_path_switch_t*) list_next(itr))){ if(((path_switch->geometry[X] == node_src[X]) -#ifdef HAVE_BGL +#ifdef HAVE_BG && (path_switch->geometry[Y] == node_src[Y]) && (path_switch->geometry[Z] @@ -3557,9 +3557,9 @@ static int _finish_torus(pa_switch_t *curr_switch, int source_port, node_tar = curr_switch-> ext_wire[ports_to_try[i]].node_tar; - next_switch = &pa_system_ptr-> + next_switch = &ba_system_ptr-> grid[node_tar[X]] -#ifdef HAVE_BGL +#ifdef HAVE_BG [node_tar[Y]] [node_tar[Z]] #endif @@ -3583,27 +3583,27 @@ static int _finish_torus(pa_switch_t *curr_switch, int source_port, static int *_set_best_path() { ListIterator itr; - pa_path_switch_t *path_switch = NULL; - pa_switch_t *curr_switch = NULL; + ba_path_switch_t *path_switch = NULL; + ba_switch_t *curr_switch = NULL; int *geo = NULL; if(!best_path) return NULL; itr = list_iterator_create(best_path); - while((path_switch = (pa_path_switch_t*) list_next(itr))) { -#ifdef HAVE_BGL + while((path_switch = (ba_path_switch_t*) list_next(itr))) { +#ifdef HAVE_BG debug3("mapping %d%d%d",path_switch->geometry[X], path_switch->geometry[Y], path_switch->geometry[Z]); if(!geo) geo = path_switch->geometry; - curr_switch = &pa_system_ptr-> + curr_switch = &ba_system_ptr-> grid [path_switch->geometry[X]] [path_switch->geometry[Y]] [path_switch->geometry[Z]]. axis_switch[path_switch->dim]; #else - curr_switch = &pa_system_ptr-> + curr_switch = &ba_system_ptr-> grid[path_switch->geometry[X]]. axis_switch[path_switch->dim]; #endif @@ -3624,12 +3624,12 @@ static int *_set_best_path() static int _set_one_dim(int *start, int *end, int *coord) { int dim; - pa_switch_t *curr_switch = NULL; + ba_switch_t *curr_switch = NULL; - for(dim=0;dim<PA_SYSTEM_DIMENSIONS;dim++) { + for(dim=0;dim<BA_SYSTEM_DIMENSIONS;dim++) { if(start[dim]==end[dim]) { - curr_switch = &pa_system_ptr->grid[coord[X]] -#ifdef HAVE_BGL + curr_switch = &ba_system_ptr->grid[coord[X]] +#ifdef HAVE_BG [coord[Y]] [coord[Z]] #endif @@ -3652,7 +3652,7 @@ static int _set_one_dim(int *start, int *end, int *coord) /** */ int main(int argc, char** argv) { - pa_request_t *request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); + ba_request_t *request = (ba_request_t*) xmalloc(sizeof(ba_request_t)); log_options_t log_opts = LOG_OPTS_INITIALIZER; int debug_level = 6; @@ -3669,7 +3669,7 @@ int main(int argc, char** argv) DIM_SIZE[X]=0; DIM_SIZE[Y]=0; DIM_SIZE[Z]=0; - pa_init(NULL); + ba_init(NULL); init_wires(NULL); /* results = list_create(NULL); */ @@ -3684,9 +3684,9 @@ int main(int argc, char** argv) /* request->rotate = 0; */ /* request->elongate = 0; */ /* request->conn_type = TORUS; */ -/* new_pa_request(request); */ -/* print_pa_request(request); */ -/* if(!allocate_part(request, results)) { */ +/* new_ba_request(request); */ +/* print_ba_request(request); */ +/* if(!allocate_block(request, results)) { */ /* debug("couldn't allocate %d%d%d", */ /* request->geometry[0], */ /* request->geometry[1], */ @@ -3706,9 +3706,9 @@ int main(int argc, char** argv) request->rotate = 0; request->elongate = 0; request->conn_type = TORUS; - new_pa_request(request); - print_pa_request(request); - if(!allocate_part(request, results)) { + new_ba_request(request); + print_ba_request(request); + if(!allocate_block(request, results)) { debug("couldn't allocate %d%d%d", request->geometry[0], request->geometry[1], @@ -3723,9 +3723,9 @@ int main(int argc, char** argv) request->start_req = 0; request->size = 1; request->conn_type = TORUS; - new_pa_request(request); - print_pa_request(request); - if(!allocate_part(request, results)) { + new_ba_request(request); + print_ba_request(request); + if(!allocate_block(request, results)) { debug("couldn't allocate %d%d%d", request->geometry[0], request->geometry[1], @@ -3739,9 +3739,9 @@ int main(int argc, char** argv) /* request->geometry[2] = 4; */ /* //request->size = 2; */ /* request->conn_type = TORUS; */ -/* new_pa_request(request); */ -/* print_pa_request(request); */ -/* if(!allocate_part(request, results)) { */ +/* new_ba_request(request); */ +/* print_ba_request(request); */ +/* if(!allocate_block(request, results)) { */ /* printf("couldn't allocate %d%d%d\n", */ /* request->geometry[0], */ /* request->geometry[1], */ @@ -3754,9 +3754,9 @@ int main(int argc, char** argv) /* request->geometry[2] = 4; */ /* //request->size = 2; */ /* request->conn_type = TORUS; */ -/* new_pa_request(request); */ -/* print_pa_request(request); */ -/* if(!allocate_part(request, results)) { */ +/* new_ba_request(request); */ +/* print_ba_request(request); */ +/* if(!allocate_block(request, results)) { */ /* printf("couldn't allocate %d%d%d\n", */ /* request->geometry[0], */ /* request->geometry[1], */ @@ -3776,12 +3776,12 @@ int main(int argc, char** argv) for(y=starty;y<endy;y++) { for(z=startz;z<endz;z++) { info("Node %d%d%d Used = %d Letter = %c", - x,y,z,pa_system_ptr->grid[x][y][z].used, - pa_system_ptr->grid[x][y][z].letter); + x,y,z,ba_system_ptr->grid[x][y][z].used, + ba_system_ptr->grid[x][y][z].letter); for(dim=0;dim<1;dim++) { info("Dim %d",dim); - pa_switch_t *wire = - &pa_system_ptr-> + ba_switch_t *wire = + &ba_system_ptr-> grid[x][y][z].axis_switch[dim]; for(j=0;j<6;j++) info("\t%d -> %d -> %d%d%d %d " @@ -3811,9 +3811,9 @@ int main(int argc, char** argv) } /* list_destroy(results); */ -/* pa_fini(); */ +/* ba_fini(); */ -/* delete_pa_request(request); */ +/* delete_ba_request(request); */ return 0; } diff --git a/src/partition_allocator/partition_allocator.h b/src/plugins/select/bluegene/block_allocator/block_allocator.h similarity index 73% rename from src/partition_allocator/partition_allocator.h rename to src/plugins/select/bluegene/block_allocator/block_allocator.h index fdd6ade5855e8f3b306ed0f7c96e23e7cd6cdc08..ad2837e688a490142b5cd19b5b84daa9e83d5060 100644 --- a/src/partition_allocator/partition_allocator.h +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.h @@ -1,5 +1,5 @@ /*****************************************************************************\ - * partition_allocator.h + * block_allocator.h * ***************************************************************************** * Copyright (C) 2004 The Regents of the University of California. @@ -24,8 +24,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. \*****************************************************************************/ -#ifndef _PARTITION_ALLOCATOR_H_ -#define _PARTITION_ALLOCATOR_H_ +#ifndef _BLOCK_ALLOCATOR_H_ +#define _BLOCK_ALLOCATOR_H_ /* This must be included first for AIX systems */ #include "src/common/macros.h" @@ -64,10 +64,10 @@ #define NUM_PORTS_PER_NODE 6 -#ifdef HAVE_BGL -#define PA_SYSTEM_DIMENSIONS 3 +#ifdef HAVE_BG +#define BA_SYSTEM_DIMENSIONS 3 #else -#define PA_SYSTEM_DIMENSIONS 1 +#define BA_SYSTEM_DIMENSIONS 1 #endif extern bool _initialized; @@ -79,9 +79,9 @@ enum {X, Y, Z}; enum {MESH, TORUS, SMALL}; enum {COPROCESSOR, VIRTUAL}; -/* NOTE: Definition of bgl_info_record_t moved to src/api/node_select_info.h */ +/* NOTE: Definition of bg_info_record_t moved to src/api/node_select_info.h */ -extern List bgl_info_list; /* List of BGL blocks */ +extern List bg_info_list; /* List of BG blocks */ /** * structure that holds switch path information for finding the wiring @@ -94,11 +94,11 @@ extern List bgl_info_list; /* List of BGL blocks */ * */ typedef struct { - int geometry[PA_SYSTEM_DIMENSIONS]; + int geometry[BA_SYSTEM_DIMENSIONS]; int dim; int in; int out; -} pa_path_switch_t; +} ba_path_switch_t; /** * structure that holds the configuration settings for each request @@ -116,8 +116,8 @@ typedef struct { */ typedef struct { char *save_name; - int geometry[PA_SYSTEM_DIMENSIONS]; - int start[PA_SYSTEM_DIMENSIONS]; + int geometry[BA_SYSTEM_DIMENSIONS]; + int start[BA_SYSTEM_DIMENSIONS]; int start_req; int size; int conn_type; @@ -127,7 +127,7 @@ typedef struct { bool elongate; bool force_contig; List elongate_geos; -} pa_request_t; +} ba_request_t; /** * structure that holds the configuration settings for each connection @@ -147,9 +147,9 @@ typedef struct int port_tar; /* target label */ - int node_tar[PA_SYSTEM_DIMENSIONS]; + int node_tar[BA_SYSTEM_DIMENSIONS]; bool used; -} pa_connection_t; +} ba_connection_t; /** * structure that holds the configuration settings for each switch * which pretty much means the wiring information @@ -161,21 +161,21 @@ typedef struct */ typedef struct { - pa_connection_t int_wire[NUM_PORTS_PER_NODE]; - pa_connection_t ext_wire[NUM_PORTS_PER_NODE]; + ba_connection_t int_wire[NUM_PORTS_PER_NODE]; + ba_connection_t ext_wire[NUM_PORTS_PER_NODE]; -} pa_switch_t; +} ba_switch_t; /* - * pa_node_t: node within the allocation system. + * ba_node_t: node within the allocation system. */ typedef struct { - /* set if using this node in a partition*/ + /* set if using this node in a block*/ bool used; /* coordinates */ - int coord[PA_SYSTEM_DIMENSIONS]; - pa_switch_t axis_switch[PA_SYSTEM_DIMENSIONS]; + int coord[BA_SYSTEM_DIMENSIONS]; + ba_switch_t axis_switch[BA_SYSTEM_DIMENSIONS]; char letter; int color; int indecies; @@ -183,7 +183,7 @@ typedef struct { int conn_type; int phys_x; -} pa_node_t; +} ba_node_t; typedef struct { int xcord; @@ -197,43 +197,43 @@ typedef struct { #endif time_t now_time; - /* made to hold info about a system, which right now is only a grid of pa_nodes*/ -#ifdef HAVE_BGL - pa_node_t ***grid; + /* made to hold info about a system, which right now is only a grid of ba_nodes*/ +#ifdef HAVE_BG + ba_node_t ***grid; #else - pa_node_t *grid; + ba_node_t *grid; #endif -} pa_system_t; +} ba_system_t; -/* Used to Keep track of where the Base Partitions are at all times +/* Used to Keep track of where the Base Blocks are at all times Rack and Midplane is the bp_id and XYZ is the coords. */ typedef struct { char *bp_id; - int coord[PA_SYSTEM_DIMENSIONS]; -} pa_bp_map_t; + int coord[BA_SYSTEM_DIMENSIONS]; +} ba_bp_map_t; /* Global */ extern List bp_map_list; extern char letters[62]; extern char colors[6]; -extern int DIM_SIZE[PA_SYSTEM_DIMENSIONS]; +extern int DIM_SIZE[BA_SYSTEM_DIMENSIONS]; -/* destroy a bgl_info_record_t */ -extern void destroy_bgl_info_record(void* object); +/* destroy a bg_info_record_t */ +extern void destroy_bg_info_record(void* object); /** - * create a partition request. Note that if the geometry is given, + * create a block request. Note that if the geometry is given, * then size is ignored. If elongate is true, the algorithm will try - * to fit that a partition of cubic shape and then it will try other + * to fit that a block of cubic shape and then it will try other * elongated geometries. (ie, 2x2x2 -> 4x2x1 -> 8x1x1). Note that * size must be a power of 2, given 3 dimensions. * - * OUT - pa_request: structure to allocate and fill in. - * IN - geometry: requested geometry of partition - * IN - size: requested size of partition - * IN - rotate: if true, allows rotation of partition during fit + * OUT - ba_request: structure to allocate and fill in. + * IN - geometry: requested geometry of block + * IN - size: requested size of block + * IN - rotate: if true, allows rotation of block during fit * IN - elongate: if true, will try to fit different geometries of * same size requests * IN - contig: enforce contiguous regions constraint @@ -241,59 +241,59 @@ extern void destroy_bgl_info_record(void* object); * * return success of allocation/validation of params */ -extern int new_pa_request(pa_request_t* pa_request); +extern int new_ba_request(ba_request_t* ba_request); /** - * delete a partition request + * delete a block request */ -extern void delete_pa_request(pa_request_t* pa_request); +extern void delete_ba_request(ba_request_t* ba_request); /** - * print a partition request + * print a block request */ -extern void print_pa_request(pa_request_t* pa_request); +extern void print_ba_request(ba_request_t* ba_request); /** - * Initialize internal structures by either reading previous partition + * Initialize internal structures by either reading previous block * configurations from a file or by running the graph solver. * * IN: dunno yet, probably some stuff denoting downed nodes, etc. * * return: success or error of the intialization. */ -extern void pa_init(); +extern void ba_init(); /** */ extern void init_wires(); /** * destroy all the internal (global) data structs. */ -extern void pa_fini(); +extern void ba_fini(); /** * set the node in the internal configuration as unusable * * IN c: coordinate of the node to put down */ -extern void pa_set_node_down(pa_node_t *pa_node); +extern void ba_set_node_down(ba_node_t *ba_node); /** - * Try to allocate a partition. + * Try to allocate a block. * - * IN - pa_request: allocation request + * IN - ba_request: allocation request * OUT - results: List of results of the allocation request. Each - * list entry will be a coordinate. allocate_part will create the + * list entry will be a coordinate. allocate_block will create the * list, but the caller must destroy it. * * return: success or error of request */ -extern int allocate_part(pa_request_t* pa_request, List results); +extern int allocate_block(ba_request_t* ba_request, List results); /** * Admin wants to remove a previous allocation. * will allow Admin to delete a previous allocation retrival by letter code. */ -extern int remove_part(List nodes, int new_count); +extern int remove_block(List nodes, int new_count); /** * Admin wants to change something about a previous allocation. @@ -301,19 +301,19 @@ extern int remove_part(List nodes, int new_count); * letter code for the allocation and the variable to alter * */ -extern int alter_part(List nodes, int conn_type); +extern int alter_block(List nodes, int conn_type); /** - * After a partition is deleted or altered following allocations must + * After a block is deleted or altered following allocations must * be redone to make sure correct path will be used in the real system * */ -extern int redo_part(List nodes, int *geo, int conn_type, int new_count); +extern int redo_block(List nodes, int *geo, int conn_type, int new_count); -extern char *set_bgl_part(List results, int *start, +extern char *set_bg_block(List results, int *start, int *geometry, int conn_type); -extern int reset_pa_system(); +extern int reset_ba_system(); extern void init_grid(node_info_msg_t *node_info_ptr); @@ -323,7 +323,7 @@ extern void init_grid(node_info_msg_t *node_info_ptr); extern int set_bp_map(void); /** - * find a base partitions bgl location + * find a base blocks bg location */ extern int *find_bp_loc(char* bp_id); @@ -332,4 +332,4 @@ extern int *find_bp_loc(char* bp_id); */ extern char *find_bp_rack_mid(char* xyz); -#endif /* _PARTITION_ALLOCATOR_H_ */ +#endif /* _BLOCK_ALLOCATOR_H_ */ diff --git a/src/plugins/select/bluegene/bluegene.c b/src/plugins/select/bluegene/bluegene.c deleted file mode 100644 index e4f054ed4686714ee8fa42a4e5584c0c9a025c4e..0000000000000000000000000000000000000000 --- a/src/plugins/select/bluegene/bluegene.c +++ /dev/null @@ -1,1815 +0,0 @@ -/*****************************************************************************\ - * bluegene.c - blue gene node configuration processing module. - * - * $Id$ - ***************************************************************************** - * Copyright (C) 2004 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Danny Auble <auble1@llnl.gov> et. al. - * - * This file is part of SLURM, a resource management program. - * For details, see <http://www.llnl.gov/linux/slurm/>. - * - * SLURM is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along - * with SLURM; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -\*****************************************************************************/ - -#include "bluegene.h" -#include <stdio.h> - -#define BUFSIZE 4096 -#define BITSIZE 128 -#define MMCS_POLL_TIME 120 /* poll MMCS for down switches and nodes - * every 120 secs */ -#define BGL_POLL_TIME 0 /* poll bgl partitions every 3 secs */ - -#define _DEBUG 0 - -char* bgl_conf = NULL; - -/* Global variables */ -rm_BGL_t *bgl; -List bgl_list = NULL; /* list of bgl_record entries */ -List bgl_curr_part_list = NULL; /* current bgl partitions */ -List bgl_found_part_list = NULL; /* found bgl partitions */ -char *bluegene_blrts = NULL, *bluegene_linux = NULL, *bluegene_mloader = NULL; -char *bluegene_ramdisk = NULL, *bridge_api_file = NULL; -char *change_numpsets = NULL; -int numpsets; -bool agent_fini = false; -int bridge_api_verb = 0; -time_t last_bgl_update; -pthread_mutex_t part_state_mutex = PTHREAD_MUTEX_INITIALIZER; -int num_part_to_free = 0; -int num_part_freed = 0; -int partitions_are_created = 0; -bgl_record_t *full_system_partition = NULL; - -#ifdef HAVE_BGL_FILES - static pthread_mutex_t freed_cnt_mutex = PTHREAD_MUTEX_INITIALIZER; - static int _update_bgl_record_state(List bgl_destroy_list); -#else -# if PA_SYSTEM_DIMENSIONS==3 - int max_dim[PA_SYSTEM_DIMENSIONS] = { 0, 0, 0 }; -# else - int max_dim[PA_SYSTEM_DIMENSIONS] = { 0 }; -# endif -#endif - -/* some local functions */ -#ifdef HAVE_BGL -static int _addto_node_list(bgl_record_t *bgl_record, int *start, int *end); -#endif -#ifdef HAVE_BGL_FILES -#endif -static void _set_bgl_lists(); -static int _validate_config_nodes(void); -static int _bgl_record_cmpf_inc(bgl_record_t* rec_a, bgl_record_t* rec_b); -static int _delete_old_partitions(void); -static char *_get_bgl_conf(void); -static void _strip_13_10(char *line); -static int _parse_bgl_spec(char *in_line); -static void _process_nodes(bgl_record_t *bgl_record); -static int _reopen_bridge_log(void); - -/* Initialize all plugin variables */ -extern int init_bgl(void) -{ -#ifdef HAVE_BGL_FILES - int rc; - rm_size3D_t bp_size; - - info("Attempting to contact MMCS"); - if ((rc = rm_set_serial(BGL_SERIAL)) != STATUS_OK) { - fatal("init_bgl: rm_set_serial(): %s", bgl_err_str(rc)); - return SLURM_ERROR; - } - - if ((rc = rm_get_BGL(&bgl)) != STATUS_OK) { - fatal("init_bgl: rm_get_BGL(): %s", bgl_err_str(rc)); - return SLURM_ERROR; - } - - if ((rc = rm_get_data(bgl, RM_Msize, &bp_size)) != STATUS_OK) { - fatal("init_bgl: rm_get_data(): %s", bgl_err_str(rc)); - return SLURM_ERROR; - } - verbose("BlueGene configured with %d x %d x %d base partitions", - bp_size.X, bp_size.Y, bp_size.Z); - DIM_SIZE[X]=bp_size.X; - DIM_SIZE[Y]=bp_size.Y; - DIM_SIZE[Z]=bp_size.Z; -#endif - pa_init(NULL); - - info("BlueGene plugin loaded successfully"); - - return SLURM_SUCCESS; -} - -/* Purge all plugin variables */ -extern void fini_bgl(void) -{ - int rc; - - _set_bgl_lists(); - - if (bgl_list) { - list_destroy(bgl_list); - bgl_list = NULL; - } - - if (bgl_curr_part_list) { - list_destroy(bgl_curr_part_list); - bgl_curr_part_list = NULL; - } - - if (bgl_found_part_list) { - list_destroy(bgl_found_part_list); - bgl_found_part_list = NULL; - } - - xfree(bluegene_blrts); - xfree(bluegene_linux); - xfree(bluegene_mloader); - xfree(bluegene_ramdisk); - xfree(bridge_api_file); - -#ifdef HAVE_BGL_FILES - if(bgl) - if ((rc = rm_free_BGL(bgl)) != STATUS_OK) - error("rm_free_BGL(): %s", bgl_err_str(rc)); -#endif - pa_fini(); -} - -extern void print_bgl_record(bgl_record_t* bgl_record) -{ - if (!bgl_record) { - error("print_bgl_record, record given is null"); - return; - } -#if _DEBUG - info(" bgl_record: "); - if (bgl_record->bgl_part_id) - info("\tbgl_part_id: %s", bgl_record->bgl_part_id); - info("\tnodes: %s", bgl_record->nodes); - info("\tsize: %d", bgl_record->bp_count); - info("\tgeo: %dx%dx%d", bgl_record->geo[X], bgl_record->geo[Y], - bgl_record->geo[Z]); - info("\tlifecycle: %s", convert_lifecycle(bgl_record->part_lifecycle)); - info("\tconn_type: %s", convert_conn_type(bgl_record->conn_type)); - info("\tnode_use: %s", convert_node_use(bgl_record->node_use)); - if (bgl_record->hostlist) { - char buffer[BUFSIZE]; - hostlist_ranged_string(bgl_record->hostlist, BUFSIZE, buffer); - info("\thostlist %s", buffer); - } - if (bgl_record->bitmap) { - char bitstring[BITSIZE]; - bit_fmt(bitstring, BITSIZE, bgl_record->bitmap); - info("\tbitmap: %s", bitstring); - } -#else - info("bgl_part_id=%s nodes=%s", bgl_record->bgl_part_id, - bgl_record->nodes); -#endif -} - -extern void destroy_bgl_record(void* object) -{ - bgl_record_t* bgl_record = (bgl_record_t*) object; - - if (bgl_record) { - xfree(bgl_record->nodes); - xfree(bgl_record->user_name); - xfree(bgl_record->target_name); - if(bgl_record->bgl_part_list) - list_destroy(bgl_record->bgl_part_list); - if(bgl_record->hostlist) - hostlist_destroy(bgl_record->hostlist); - if(bgl_record->bitmap) - bit_free(bgl_record->bitmap); - xfree(bgl_record->bgl_part_id); - - xfree(bgl_record); - } -} - - -extern bgl_record_t *find_bgl_record(char *bgl_part_id) -{ - ListIterator itr; - bgl_record_t *bgl_record = NULL; - - if(!bgl_part_id) - return NULL; - - if(bgl_list) { - itr = list_iterator_create(bgl_list); - while ((bgl_record = - (bgl_record_t *) list_next(itr)) != NULL) { - if(bgl_record->bgl_part_id) - if (!strcmp(bgl_record->bgl_part_id, - bgl_part_id)) - break; - } - list_iterator_destroy(itr); - if(bgl_record) - return bgl_record; - else - return NULL; - } else { - error("find_bgl_record: no bgl_list"); - return NULL; - } - -} -/* All changes to the bgl_list target_name must - be done before this function is called. -*/ -extern int update_partition_user(bgl_record_t *bgl_record) -{ -#ifdef HAVE_BGL_FILES - int rc=0; - struct passwd *pw_ent = NULL; - - if(!bgl_record->target_name) { - error("Must set target_name to run update_partition_user."); - return -1; - } - - if((rc = remove_all_users(bgl_record->bgl_part_id, - bgl_record->target_name)) - == REMOVE_USER_ERR) { - error("Something happened removing " - "users from partition %s", - bgl_record->bgl_part_id); - return -1; - } else if (rc == REMOVE_USER_NONE) { - if (strcmp(bgl_record->target_name, - slurmctld_conf.slurm_user_name)) { - info("Adding user %s to Partition %s", - bgl_record->target_name, - bgl_record->bgl_part_id); - - if ((rc = rm_add_part_user(bgl_record->bgl_part_id, - bgl_record->target_name)) - != STATUS_OK) { - error("rm_add_part_user(%s,%s): %s", - bgl_record->bgl_part_id, - bgl_record->target_name, - bgl_err_str(rc)); - return -1; - } - } - } - - if(strcmp(bgl_record->target_name, bgl_record->user_name)) { - xfree(bgl_record->user_name); - bgl_record->user_name = xstrdup(bgl_record->target_name); - if((pw_ent = getpwnam(bgl_record->user_name)) == NULL) { - error("getpwnam(%s): %m", bgl_record->user_name); - return -1; - } else { - bgl_record->user_uid = pw_ent->pw_uid; - } - return 1; - } - -#endif - return 0; -} - -extern int remove_all_users(char *bgl_part_id, char *user_name) -{ - int returnc = REMOVE_USER_NONE; -#ifdef HAVE_BGL_FILES - char *user; - rm_partition_t *part_ptr = NULL; - int rc, i, user_count; - - if ((rc = rm_get_partition(bgl_part_id, &part_ptr)) != STATUS_OK) { - error("rm_get_partition(%s): %s", - bgl_part_id, - bgl_err_str(rc)); - return REMOVE_USER_ERR; - } - - if((rc = rm_get_data(part_ptr, RM_PartitionUsersNum, &user_count)) - != STATUS_OK) { - error("rm_get_data(RM_PartitionUsersNum): %s", - bgl_err_str(rc)); - returnc = REMOVE_USER_ERR; - user_count = 0; - } else - debug2("got %d users for %s",user_count, bgl_part_id); - for(i=0; i<user_count; i++) { - if(i) { - if ((rc = rm_get_data(part_ptr, - RM_PartitionNextUser, - &user)) - != STATUS_OK) { - error("rm_get_partition(%s): %s", - bgl_part_id, - bgl_err_str(rc)); - returnc = REMOVE_USER_ERR; - break; - } - } else { - if ((rc = rm_get_data(part_ptr, - RM_PartitionFirstUser, - &user)) - != STATUS_OK) { - error("rm_get_data(%s): %s", - bgl_part_id, - bgl_err_str(rc)); - returnc = REMOVE_USER_ERR; - break; - } - } - if(!user) { - error("No user was returned from database"); - continue; - } - if(!strcmp(user, slurmctld_conf.slurm_user_name)) { - free(user); - continue; - } - - if(user_name) { - if(!strcmp(user, user_name)) { - returnc = REMOVE_USER_FOUND; - free(user); - continue; - } - } - - info("Removing user %s from Partition %s", - user, - bgl_part_id); - if ((rc = rm_remove_part_user(bgl_part_id, user)) - != STATUS_OK) { - debug("user %s isn't on partition %s", - user, - bgl_part_id); - } - free(user); - } - if ((rc = rm_free_partition(part_ptr)) != STATUS_OK) { - error("rm_free_partition(): %s", bgl_err_str(rc)); - } -#endif - return returnc; -} - -extern void set_part_user(bgl_record_t *bgl_record) -{ - int rc = 0; - debug("resetting the boot state flag and " - "counter for partition %s.", - bgl_record->bgl_part_id); - bgl_record->boot_state = 0; - bgl_record->boot_count = 0; - if((rc = update_partition_user(bgl_record)) == 1) { - last_bgl_update = time(NULL); - } else if (rc == -1) { - error("Unable to add user name to partition %s. " - "Cancelling job.", - bgl_record->bgl_part_id); - (void) slurm_fail_job( - bgl_record->job_running); - //term_jobs_on_part(bgl_record->bgl_part_id); - } - xfree(bgl_record->target_name); - bgl_record->target_name = - xstrdup(slurmctld_conf.slurm_user_name); -} - -extern char* convert_lifecycle(lifecycle_type_t lifecycle) -{ - if (lifecycle == DYNAMIC) - return "DYNAMIC"; - else - return "STATIC"; -} - -extern char* convert_conn_type(rm_connection_type_t conn_type) -{ - switch (conn_type) { - case (SELECT_MESH): - return "MESH"; - case (SELECT_TORUS): - return "TORUS"; - case (SELECT_NAV): - return "NAV"; - default: - break; - } - return ""; -} - -extern char* convert_node_use(rm_partition_mode_t pt) -{ - switch (pt) { - case (SELECT_COPROCESSOR_MODE): - return "COPROCESSOR"; - case (SELECT_VIRTUAL_NODE_MODE): - return "VIRTUAL"; - default: - break; - } - return ""; -} - -/** - * sort the partitions by increasing size - */ -extern void sort_bgl_record_inc_size(List records){ - if (records == NULL) - return; - list_sort(records, (ListCmpF) _bgl_record_cmpf_inc); -} - -/* - * bluegene_agent - detached thread periodically updates status of - * bluegene nodes. - * - * NOTE: I don't grab any locks here because slurm_drain_nodes grabs - * the necessary locks. - */ -extern void *bluegene_agent(void *args) -{ - static time_t last_mmcs_test; - static time_t last_bgl_test; - int rc; - - last_mmcs_test = time(NULL) + MMCS_POLL_TIME; - last_bgl_test = time(NULL) + BGL_POLL_TIME; - while (!agent_fini) { - time_t now = time(NULL); - - if (difftime(now, last_bgl_test) >= BGL_POLL_TIME) { - if (agent_fini) /* don't bother */ - return NULL; /* quit now */ - if(last_bgl_update) { - last_bgl_test = now; - if((rc = update_partition_list()) == 1) - last_bgl_update = now; - else if(rc == -1) - error("Error " - "with update_partition_list"); - } - } - - if (difftime(now, last_mmcs_test) >= MMCS_POLL_TIME) { - if (agent_fini) /* don't bother */ - return NULL; /* quit now */ - last_mmcs_test = now; - test_mmcs_failures(); /* can run for a while */ - } - - sleep(1); - } - return NULL; -} - -/* - * Convert a BGL API error code to a string - * IN inx - error code from any of the BGL Bridge APIs - * RET - string describing the error condition - */ -extern char *bgl_err_str(status_t inx) -{ -#ifdef HAVE_BGL_FILES - switch (inx) { - case STATUS_OK: - return "Status OK"; - case PARTITION_NOT_FOUND: - return "Partition not found"; - case JOB_NOT_FOUND: - return "Job not found"; - case BP_NOT_FOUND: - return "Base partition not found"; - case SWITCH_NOT_FOUND: - return "Switch not found"; - case JOB_ALREADY_DEFINED: - return "Job already defined"; - case CONNECTION_ERROR: - return "Connection error"; - case INTERNAL_ERROR: - return "Internal error"; - case INVALID_INPUT: - return "Invalid input"; - case INCOMPATIBLE_STATE: - return "Incompatible state"; - case INCONSISTENT_DATA: - return "Inconsistent data"; - } -#endif - - return "?"; -} - -/* - * create_static_partitions - create the static partitions that will be used - * for scheduling. - * IN/OUT part_list - (global, from slurmctld): SLURM's partition - * configurations. Fill in bgl_part_id - * RET - success of fitting all configurations - */ -extern int create_static_partitions(List part_list) -{ - int rc = SLURM_SUCCESS; - - ListIterator itr; - struct passwd *pw_ent = NULL; - bgl_record_t *bgl_record = NULL, *found_record = NULL; - char *name = NULL; -#ifndef HAVE_BGL_FILES - static int block_inx = 0; -#else - ListIterator itr_found; - init_wires(); -#endif - slurm_mutex_lock(&part_state_mutex); - reset_pa_system(); - - if(bgl_list) { - itr = list_iterator_create(bgl_list); - while ((bgl_record = (bgl_record_t *) list_next(itr)) - != NULL) { - if(bgl_record->bp_count>0 - && !bgl_record->full_partition - && bgl_record->cnodes_per_bp == procs_per_node) { - debug("adding %s %d%d%d", - bgl_record->nodes, - bgl_record->start[X], - bgl_record->start[Y], - bgl_record->start[Z]); - name = set_bgl_part(NULL, - bgl_record->start, - bgl_record->geo, - bgl_record->conn_type); - if(!name) { - error("I was unable to make the " - "requested partition."); - slurm_mutex_unlock(&part_state_mutex); - return SLURM_ERROR; - } - xfree(name); - } - } - list_iterator_destroy(itr); - } else { - error("create_static_partitions: no bgl_list 1"); - slurm_mutex_unlock(&part_state_mutex); - return SLURM_ERROR; - } - -#ifdef HAVE_BGL_FILES - if(bgl_list) { - itr = list_iterator_create(bgl_list); - while ((bgl_record = (bgl_record_t *) list_next(itr)) - != NULL) { - if(bgl_found_part_list) { - itr_found = list_iterator_create( - bgl_found_part_list); - while ((found_record = (bgl_record_t*) - list_next(itr_found)) != NULL) { - /*printf("%s %d %s %d\n",*/ -/* bgl_record->nodes, */ -/* bgl_record->quarter, */ -/* found_record->nodes, */ -/* found_record->quarter); */ - - if ((!strcmp(bgl_record->nodes, - found_record->nodes)) - && (bgl_record->quarter == - found_record->quarter)) { - /* don't reboot this one */ - break; - } - } - list_iterator_destroy(itr_found); - } else { - error("create_static_partitions: " - "no bgl_found_part_list 1"); - } - if(found_record == NULL) { - if((rc = configure_partition(bgl_record)) - == SLURM_ERROR) { - list_iterator_destroy(itr); - slurm_mutex_unlock(&part_state_mutex); - return rc; - } - print_bgl_record(bgl_record); - } - } - list_iterator_destroy(itr); - } else { - error("create_static_partitions: no bgl_list 2"); - slurm_mutex_unlock(&part_state_mutex); - return SLURM_ERROR; - } -#endif - - /* Here we are adding a partition that in for the entire machine - just in case it isn't in the bluegene.conf file. - */ - - reset_pa_system(); - - bgl_record = (bgl_record_t*) xmalloc(sizeof(bgl_record_t)); - bgl_record->nodes = xmalloc(sizeof(char)*13); -#ifdef HAVE_BGL_FILES - bgl_record->geo[X] = DIM_SIZE[X] - 1; - bgl_record->geo[Y] = DIM_SIZE[Y] - 1; - bgl_record->geo[Z] = DIM_SIZE[Z] - 1; -#else - bgl_record->geo[X] = max_dim[X]; - bgl_record->geo[Y] = max_dim[Y]; - bgl_record->geo[Z] = max_dim[Z]; -#endif - if((bgl_record->geo[X] == 0) && (bgl_record->geo[Y] == 0) - && (bgl_record->geo[Z] == 0)) - sprintf(bgl_record->nodes, "bgl000"); - else - sprintf(bgl_record->nodes, "bgl[000x%d%d%d]", - bgl_record->geo[X], bgl_record->geo[Y], - bgl_record->geo[Z]); - bgl_record->quarter = -1; - bgl_record->full_partition = 1; - if(bgl_found_part_list) { - itr = list_iterator_create(bgl_found_part_list); - while ((found_record = (bgl_record_t *) list_next(itr)) - != NULL) { - if (!strcmp(bgl_record->nodes, found_record->nodes)) { - destroy_bgl_record(bgl_record); - list_iterator_destroy(itr); - /* don't create total already there */ - goto no_total; - } - } - list_iterator_destroy(itr); - } else { - error("create_static_partitions: no bgl_found_part_list 2"); - } - - if(bgl_list) { - itr = list_iterator_create(bgl_list); - while ((found_record = (bgl_record_t *) list_next(itr)) - != NULL) { - if (!strcmp(bgl_record->nodes, found_record->nodes)) { - destroy_bgl_record(bgl_record); - list_iterator_destroy(itr); - /* don't create total already defined */ - goto no_total; - } - } - list_iterator_destroy(itr); - } else { - error("create_static_partitions: no bgl_list 3"); - slurm_mutex_unlock(&part_state_mutex); - return SLURM_ERROR; - } - full_system_partition = bgl_record; - bgl_record->bgl_part_list = list_create(NULL); - bgl_record->hostlist = hostlist_create(NULL); - /* bgl_record->boot_state = 0; Implicit */ - _process_nodes(bgl_record); - list_append(bgl_list, bgl_record); - - bgl_record->conn_type = SELECT_TORUS; - bgl_record->user_name = xstrdup(slurmctld_conf.slurm_user_name); - bgl_record->target_name = xstrdup(slurmctld_conf.slurm_user_name); - if((pw_ent = getpwnam(bgl_record->user_name)) == NULL) { - error("getpwnam(%s): %m", bgl_record->user_name); - slurm_mutex_unlock(&part_state_mutex); - return SLURM_ERROR; - } else { - bgl_record->user_uid = pw_ent->pw_uid; - } - - name = set_bgl_part(NULL, - bgl_record->start, - bgl_record->geo, - bgl_record->conn_type); - - if(!name) { - error("I was unable to make the " - "requested partition."); - slurm_mutex_unlock(&part_state_mutex); - return SLURM_ERROR; - } - xfree(name); - bgl_record->node_use = SELECT_COPROCESSOR_MODE; - bgl_record->cnodes_per_bp = procs_per_node; -#ifdef HAVE_BGL_FILES - if((rc = configure_partition(bgl_record)) == SLURM_ERROR) { - slurm_mutex_unlock(&part_state_mutex); - return rc; - } - print_bgl_record(bgl_record); - -#else - if(bgl_list) { - itr = list_iterator_create(bgl_list); - while ((bgl_record = (bgl_record_t*) list_next(itr))) { - if (bgl_record->bgl_part_id) - continue; - bgl_record->bgl_part_id = xmalloc(8); - snprintf(bgl_record->bgl_part_id, 8, "RMP%d", - block_inx++); - info("BGL PartitionID:%s Nodes:%s Conn:%s Mode:%s", - bgl_record->bgl_part_id, bgl_record->nodes, - convert_conn_type(bgl_record->conn_type), - convert_node_use(bgl_record->node_use)); - } - list_iterator_destroy(itr); - } else { - error("create_static_partitions: no bgl_list 4"); - slurm_mutex_unlock(&part_state_mutex); - return SLURM_ERROR; - } -#endif /* HAVE_BGL_FILES */ - -no_total: - if(bgl_list) { - itr = list_iterator_create(bgl_list); - while ((bgl_record = (bgl_record_t*) list_next(itr)) != NULL) { -#ifdef HAVE_BGL_FILES - if ((bgl_record->geo[X] == DIM_SIZE[X]) - && (bgl_record->geo[Y] == DIM_SIZE[Y]) - && (bgl_record->geo[Z] == DIM_SIZE[Z])) { -#else - if ((bgl_record->geo[X] == max_dim[X]+1) - && (bgl_record->geo[Y] == max_dim[Y]+1) - && (bgl_record->geo[Z] == max_dim[Z]+1)) { -#endif - debug("full partiton = %s.", - bgl_record->bgl_part_id); - bgl_record->full_partition = 1; - full_system_partition = bgl_record; - break; - } - } - list_iterator_destroy(itr); - } else { - error("create_static_partitions: no bgl_list 5"); - } - last_bgl_update = time(NULL); - slurm_mutex_unlock(&part_state_mutex); -#ifdef _PRINT_PARTS_AND_EXIT - if(bgl_list) { - itr = list_iterator_create(bgl_list); - debug("\n\n"); - while ((found_record = (bgl_record_t *) list_next(itr)) - != NULL) { - print_bgl_record(found_record); - } - list_iterator_destroy(itr); - } else { - error("create_static_partitions: no bgl_list 5"); - } - exit(0); -#endif /* _PRINT_PARTS_AND_EXIT */ - rc = SLURM_SUCCESS; - //exit(0); - return rc; -} - -extern int bgl_free_partition(bgl_record_t *bgl_record) -{ -#ifdef HAVE_BGL_FILES - int rc; - if(!bgl_record) { - error("bgl_free_partition: there was no bgl_record"); - return SLURM_ERROR; - } - while (1) { - if (bgl_record->state != -1 - && bgl_record->state != RM_PARTITION_FREE - && bgl_record->state != RM_PARTITION_DEALLOCATING) { - debug("pm_destroy %s",bgl_record->bgl_part_id); - if ((rc = pm_destroy_partition( - bgl_record->bgl_part_id)) - != STATUS_OK) { - if(rc == PARTITION_NOT_FOUND) { - debug("partition %s is not found"); - break; - } - error("pm_destroy_partition(%s): %s " - "State = %d", - bgl_record->bgl_part_id, - bgl_err_str(rc), bgl_record->state); - } - } - - if ((bgl_record->state == RM_PARTITION_FREE) - || (bgl_record->state == RM_PARTITION_ERROR)) - break; - sleep(3); - } -#endif - return SLURM_SUCCESS; -} - -/* Free multiple partitions in parallel */ -extern void *mult_free_part(void *args) -{ -#ifdef HAVE_BGL_FILES - bgl_record_t *bgl_record = (bgl_record_t*) args; - - debug("freeing the partition %s.", bgl_record->bgl_part_id); - bgl_free_partition(bgl_record); - debug("done\n"); - slurm_mutex_lock(&freed_cnt_mutex); - num_part_freed++; - slurm_mutex_unlock(&freed_cnt_mutex); -#endif - return NULL; -} - -/* destroy multiple partitions in parallel */ -extern void *mult_destroy_part(void *args) -{ -#ifdef HAVE_BGL_FILES - bgl_record_t *bgl_record = (bgl_record_t*) args; - int rc; - - debug("removing the jobs on partition %s\n", - bgl_record->bgl_part_id); - term_jobs_on_part(bgl_record->bgl_part_id); - - debug("destroying %s\n", - (char *)bgl_record->bgl_part_id); - bgl_free_partition(bgl_record); - - rc = rm_remove_partition( - bgl_record->bgl_part_id); - if (rc != STATUS_OK) { - error("rm_remove_partition(%s): %s", - bgl_record->bgl_part_id, - bgl_err_str(rc)); - } else - debug("done\n"); - slurm_mutex_lock(&freed_cnt_mutex); - num_part_freed++; - slurm_mutex_unlock(&freed_cnt_mutex); - -#endif - return NULL; -} - -/* - * Read and process the bluegene.conf configuration file so to interpret what - * partitions are static/dynamic, torus/mesh, etc. - */ -extern int read_bgl_conf(void) -{ - FILE *bgl_spec_file; /* pointer to input data file */ - int line_num; /* line number in input file */ - char in_line[BUFSIZE]; /* input line */ - int i, j, error_code = SLURM_SUCCESS; - static time_t last_config_update = (time_t) 0; - struct stat config_stat; - - debug("Reading the bluegene.conf file"); - - /* check if config file has changed */ - if (!bgl_conf) - bgl_conf = _get_bgl_conf(); - if (stat(bgl_conf, &config_stat) < 0) - fatal("can't stat bluegene.conf file %s: %m", bgl_conf); - if (last_config_update) { - if(last_config_update == config_stat.st_mtime) - debug("bluegene.conf unchanged"); - else - debug("bluegene.conf changed, doing nothing"); - _reopen_bridge_log(); - last_config_update = config_stat.st_mtime; - return SLURM_SUCCESS; - } - last_config_update = config_stat.st_mtime; - - /* initialization */ - /* bgl_conf defined in bgl_node_alloc.h */ - bgl_spec_file = fopen(bgl_conf, "r"); - if (bgl_spec_file == NULL) - fatal("_read_bgl_conf error opening file %s, %m", - bgl_conf); - - _set_bgl_lists(); - - /* process the data file */ - line_num = 0; - while (fgets(in_line, BUFSIZE, bgl_spec_file) != NULL) { - line_num++; - _strip_13_10(in_line); - if (strlen(in_line) >= (BUFSIZE - 1)) { - error("_read_bgl_config line %d, of input file %s " - "too long", line_num, bgl_conf); - fclose(bgl_spec_file); - xfree(bgl_conf); - return E2BIG; - } - - /* everything after a non-escaped "#" is a comment */ - /* replace comment flag "#" with an end of string (NULL) */ - /* escape sequence "\#" translated to "#" */ - for (i = 0; i < BUFSIZE; i++) { - if (in_line[i] == (char) NULL) - break; - if (in_line[i] != '#') - continue; - if ((i > 0) && (in_line[i - 1] == '\\')) { - for (j = i; j < BUFSIZE; j++) { - in_line[j - 1] = in_line[j]; - } - continue; - } - in_line[i] = (char) NULL; - break; - } - - /* parse what is left, non-comments */ - /* partition configuration parameters */ - error_code = _parse_bgl_spec(in_line); - - /* report any leftover strings on input line */ - report_leftover(in_line, line_num); - } - fclose(bgl_spec_file); - xfree(bgl_conf); - - if (!bluegene_blrts) - fatal("BlrtsImage not configured in bluegene.conf"); - if (!bluegene_linux) - fatal("LinuxImage not configured in bluegene.conf"); - if (!bluegene_mloader) - fatal("MloaderImage not configured in bluegene.conf"); - if (!bluegene_ramdisk) - fatal("RamDiskImage not configured in bluegene.conf"); - if (!bridge_api_file) - info("BridgeAPILogFile not configured in bluegene.conf"); - else - _reopen_bridge_log(); - if (!numpsets) - info("Warning: Numpsets not configured in bluegene.conf"); -//#if 0 - /* Check to see if the configs we have are correct */ - if (_validate_config_nodes() == SLURM_ERROR) { - _delete_old_partitions(); - } -//#endif - /* looking for partitions only I created */ - if (create_static_partitions(NULL) == SLURM_ERROR) { - /* error in creating the static partitions, so - * partitions referenced by submitted jobs won't - * correspond to actual slurm partitions/bgl - * partitions. - */ - fatal("Error, could not create the static partitions"); - return SLURM_ERROR; - } - debug("Partitions have finished being created."); - partitions_are_created = 1; - - return error_code; -} - -#ifdef HAVE_BGL_FILES -static int _update_bgl_record_state(List bgl_destroy_list) -{ - rm_partition_state_flag_t part_state = PARTITION_ALL_FLAG; - char *name = NULL; - rm_partition_list_t *part_list = NULL; - int j, rc, func_rc = SLURM_SUCCESS, num_parts = 0; - rm_partition_state_t state; - rm_partition_t *part_ptr = NULL; - ListIterator itr; - bgl_record_t* bgl_record = NULL; - - if(!bgl_destroy_list) { - return SLURM_SUCCESS; - } - - if ((rc = rm_get_partitions_info(part_state, &part_list)) - != STATUS_OK) { - error("rm_get_partitions_info(): %s", bgl_err_str(rc)); - return SLURM_ERROR; - } - - if ((rc = rm_get_data(part_list, RM_PartListSize, &num_parts)) - != STATUS_OK) { - error("rm_get_data(RM_PartListSize): %s", bgl_err_str(rc)); - func_rc = SLURM_ERROR; - num_parts = 0; - } - - for (j=0; j<num_parts; j++) { - if (j) { - if ((rc = rm_get_data(part_list, - RM_PartListNextPart, - &part_ptr)) - != STATUS_OK) { - error("rm_get_data(RM_PartListNextPart): %s", - bgl_err_str(rc)); - func_rc = SLURM_ERROR; - break; - } - } else { - if ((rc = rm_get_data(part_list, - RM_PartListFirstPart, - &part_ptr)) - != STATUS_OK) { - error("rm_get_data(RM_PartListFirstPart: %s", - bgl_err_str(rc)); - func_rc = SLURM_ERROR; - break; - } - } - if ((rc = rm_get_data(part_ptr, - RM_PartitionID, - &name)) - != STATUS_OK) { - error("rm_get_data(RM_PartitionID): %s", - bgl_err_str(rc)); - func_rc = SLURM_ERROR; - break; - } - if (!name) { - error("RM_Partition is NULL"); - continue; - } - - itr = list_iterator_create(bgl_destroy_list); - while ((bgl_record = (bgl_record_t*) list_next(itr))) { - if(!bgl_record->bgl_part_id) - continue; - if(strcmp(bgl_record->bgl_part_id, name)) { - continue; - } - - slurm_mutex_lock(&part_state_mutex); - if ((rc = rm_get_data(part_ptr, - RM_PartitionState, - &state)) - != STATUS_OK) { - error("rm_get_data(RM_PartitionState): %s", - bgl_err_str(rc)); - } else if(bgl_record->state != state) { - debug("state of Partition %s was %d " - "and now is %d", - name, bgl_record->state, state); - bgl_record->state = state; - } - slurm_mutex_unlock(&part_state_mutex); - break; - } - list_iterator_destroy(itr); - free(name); - } - - if ((rc = rm_free_partition_list(part_list)) != STATUS_OK) { - error("rm_free_partition_list(): %s", bgl_err_str(rc)); - } - return func_rc; -} -#endif /* HAVE_BGL_FILES */ - -#ifdef HAVE_BGL -static int _addto_node_list(bgl_record_t *bgl_record, int *start, int *end) -{ - int node_count=0; - int x,y,z; - char node_name_tmp[7]; - debug3("%d%d%dx%d%d%d", - start[X], - start[Y], - start[Z], - end[X], - end[Y], - end[Z]); - debug3("%d%d%d", - DIM_SIZE[X], - DIM_SIZE[Y], - DIM_SIZE[Z]); - - assert(end[X] < DIM_SIZE[X]); - assert(start[X] >= 0); - assert(end[Y] < DIM_SIZE[Y]); - assert(start[Y] >= 0); - assert(end[Z] < DIM_SIZE[Z]); - assert(start[Z] >= 0); - - for (x = start[X]; x <= end[X]; x++) { - for (y = start[Y]; y <= end[Y]; y++) { - for (z = start[Z]; z <= end[Z]; z++) { - sprintf(node_name_tmp, "bgl%d%d%d", - x, y, z); - list_append(bgl_record->bgl_part_list, - &pa_system_ptr->grid[x][y][z]); - node_count++; - } - } - } - return node_count; -} -#endif //HAVE_BGL - -static void _set_bgl_lists() -{ - bgl_record_t *bgl_record = NULL; - - slurm_mutex_lock(&part_state_mutex); - if (bgl_found_part_list) { - while ((bgl_record = list_pop(bgl_found_part_list)) != NULL) { - } - } else - bgl_found_part_list = list_create(NULL); - - if (bgl_curr_part_list){ - while ((bgl_record = list_pop(bgl_curr_part_list)) != NULL){ - destroy_bgl_record(bgl_record); - } - } else - bgl_curr_part_list = list_create(destroy_bgl_record); - -/* empty the old list before reading new data */ - if (bgl_list) { - while ((bgl_record = list_pop(bgl_list)) != NULL) { - destroy_bgl_record(bgl_record); - } - } else - bgl_list = list_create(destroy_bgl_record); - slurm_mutex_unlock(&part_state_mutex); - -} - -/* - * Match slurm configuration information with current BGL partition - * configuration. Return SLURM_SUCCESS if they match, else an error - * code. Writes bgl_partition_id into bgl_list records. - */ - -static int _validate_config_nodes(void) -{ - int rc = SLURM_ERROR; -#ifdef HAVE_BGL_FILES - bgl_record_t* record = NULL; - bgl_record_t* init_record = NULL; - ListIterator itr_conf; - ListIterator itr_curr; - rm_partition_mode_t node_use; - - /* read current bgl partition info into bgl_curr_part_list */ - if (read_bgl_partitions() == SLURM_ERROR) - return SLURM_ERROR; - - if(!bgl_recover) - return SLURM_ERROR; - - if(bgl_list) { - itr_conf = list_iterator_create(bgl_list); - while ((record = (bgl_record_t*) list_next(itr_conf))) { - /* translate hostlist to ranged - string for consistent format - search here - */ - node_use = SELECT_COPROCESSOR_MODE; - - if(bgl_curr_part_list) { - itr_curr = list_iterator_create( - bgl_curr_part_list); - while ((init_record = (bgl_record_t*) - list_next(itr_curr)) - != NULL) { - if (strcasecmp(record->nodes, - init_record->nodes)) - continue; /* wrong nodes */ - if (record->conn_type - != init_record->conn_type) - continue; /* wrong conn_type */ - if(record->quarter != - init_record->quarter) - continue; /* wrong quart */ - record->bgl_part_id = xstrdup( - init_record->bgl_part_id); - record->state = init_record->state; - record->node_use = - init_record->node_use; - record->user_uid = - init_record->user_uid; - record->user_name = xstrdup( - init_record->user_name); - record->target_name = xstrdup( - init_record->target_name); - record->boot_state = - init_record->boot_state; - break; - } - list_iterator_destroy(itr_curr); - } else { - error("_validate_config_nodes: " - "no bgl_curr_part_list"); - } - if (!record->bgl_part_id) { - info("Partition found in bluegene.conf to be " - "created: Nodes:%s", - record->nodes); - rc = SLURM_ERROR; - } else { - list_append(bgl_found_part_list, record); - info("Found existing BGL PartitionID:%s " - "Nodes:%s Conn:%s Mode:%s", - record->bgl_part_id, - record->nodes, - convert_conn_type(record->conn_type), - convert_node_use(record->node_use)); - } - } - list_iterator_destroy(itr_conf); - if(bgl_curr_part_list) { - itr_curr = list_iterator_create( - bgl_curr_part_list); - while ((init_record = (bgl_record_t*) - list_next(itr_curr)) - != NULL) { - _process_nodes(init_record); - debug3("%s %d %d%d%d %d%d%d", - init_record->bgl_part_id, - init_record->bp_count, - init_record->geo[X], - init_record->geo[Y], - init_record->geo[Z], - DIM_SIZE[X], - DIM_SIZE[Y], - DIM_SIZE[Z]); - if ((init_record->geo[X] == DIM_SIZE[X]) - && (init_record->geo[Y] == DIM_SIZE[Y]) - && (init_record->geo[Z] == DIM_SIZE[Z])) { - record = (bgl_record_t*) - xmalloc(sizeof(bgl_record_t)); - list_append(bgl_list, record); - debug("full system %s", - init_record->bgl_part_id); - full_system_partition = init_record; - record->full_partition = 1; - record->bgl_part_id = xstrdup( - init_record->bgl_part_id); - record->nodes = xstrdup( - init_record->nodes); - record->state = init_record->state; - record->node_use = - init_record->node_use; - record->user_uid = - init_record->user_uid; - record->user_name = xstrdup( - init_record->user_name); - record->target_name = xstrdup( - init_record->target_name); - record->conn_type = - init_record->conn_type; - record->node_use = - init_record->node_use; - record->bp_count = - init_record->bp_count; - record->boot_state = - init_record->boot_state; - record->switch_count = - init_record->switch_count; - record->cnodes_per_bp = - init_record->cnodes_per_bp; - record->quarter = - init_record->quarter; - if((record->bitmap = - bit_copy(init_record->bitmap)) - == NULL) { - error("Unable to copy " - "bitmap for", - init_record->nodes); - } - list_append(bgl_found_part_list, - record); - info("Found existing BGL " - "PartitionID:%s " - "Nodes:%s Conn:%s Mode:%s", - record->bgl_part_id, - record->nodes, - convert_conn_type( - record->conn_type), - convert_node_use( - record->node_use)); - break; - } - } - list_iterator_destroy(itr_curr); - } else { - error("_validate_config_nodes: " - "no bgl_curr_part_list 2"); - } - - if(list_count(bgl_list) == list_count(bgl_curr_part_list)) - rc = SLURM_SUCCESS; - } else { - error("_validate_config_nodes: no bgl_list"); - rc = SLURM_ERROR; - } -#endif - - return rc; -} - -/* - * Comparator used for sorting partitions smallest to largest - * - * returns: -1: rec_a >rec_b 0: rec_a == rec_b 1: rec_a < rec_b - * - */ -static int _bgl_record_cmpf_inc(bgl_record_t* rec_a, bgl_record_t* rec_b) -{ - int size_a = rec_a->bp_count * rec_a->cnodes_per_bp; - int size_b = rec_b->bp_count * rec_b->cnodes_per_bp; - if (size_a < size_b) - return -1; - else if (size_a > size_b) - return 1; - else - return 0; -} - -static int _delete_old_partitions(void) -{ -#ifdef HAVE_BGL_FILES - ListIterator itr_curr, itr_found; - bgl_record_t *found_record = NULL, *init_record = NULL; - pthread_attr_t attr_agent; - pthread_t thread_agent; - int retries; - List bgl_destroy_list = list_create(NULL); - - num_part_to_free = 0; - num_part_freed = 0; - - if(!bgl_recover) { - if(bgl_curr_part_list) { - itr_curr = list_iterator_create(bgl_curr_part_list); - while ((init_record = (bgl_record_t*) - list_next(itr_curr))) { - slurm_attr_init(&attr_agent); - if (pthread_attr_setdetachstate( - &attr_agent, - PTHREAD_CREATE_JOINABLE)) - error("pthread_attr_setdetach" - "state error %m"); - - list_push(bgl_destroy_list, init_record); - retries = 0; - while (pthread_create(&thread_agent, - &attr_agent, - mult_destroy_part, - (void *) - init_record)) { - error("pthread_create " - "error %m"); - if (++retries - > MAX_PTHREAD_RETRIES) - fatal("Can't create " - "pthread"); - /* sleep and retry */ - usleep(1000); - } - num_part_to_free++; - } - list_iterator_destroy(itr_curr); - } else { - error("_delete_old_partitions: " - "no bgl_curr_part_list 1"); - return SLURM_ERROR; - } - } else { - if(bgl_curr_part_list) { - itr_curr = list_iterator_create(bgl_curr_part_list); - while ((init_record = (bgl_record_t*) - list_next(itr_curr))) { - if(bgl_found_part_list) { - itr_found = list_iterator_create( - bgl_found_part_list); - while ((found_record = (bgl_record_t*) - list_next(itr_found)) - != NULL) { - if (!strcmp(init_record-> - bgl_part_id, - found_record-> - bgl_part_id)) { - /* don't delete - this one - */ - break; - } - } - list_iterator_destroy(itr_found); - } else { - error("_delete_old_partitions: " - "no bgl_found_part_list"); - return SLURM_ERROR; - } - if(found_record == NULL) { - slurm_attr_init(&attr_agent); - if (pthread_attr_setdetachstate( - &attr_agent, - PTHREAD_CREATE_JOINABLE)) - error("pthread_attr_setdetach" - "state error %m"); - - list_push(bgl_destroy_list, - init_record); - retries = 0; - while (pthread_create( - &thread_agent, - &attr_agent, - mult_destroy_part, - (void *)init_record)) { - error("pthread_create " - "error %m"); - if (++retries - > MAX_PTHREAD_RETRIES) - fatal("Can't create " - "pthread"); - /* sleep and retry */ - usleep(1000); - } - num_part_to_free++; - } - } - list_iterator_destroy(itr_curr); - } else { - error("_delete_old_partitions: " - "no bgl_curr_part_list 2"); - return SLURM_ERROR; - } - } - retries=30; - while(num_part_to_free != num_part_freed) { - _update_bgl_record_state(bgl_destroy_list); - if(retries==30) { - info("Waiting for old partitions to be " - "freed. Have %d of %d", - num_part_freed, - num_part_to_free); - retries=0; - } - retries++; - sleep(1); - } - list_destroy(bgl_destroy_list); - -#endif - return SLURM_SUCCESS; -} - -static char *_get_bgl_conf(void) -{ - char *val = getenv("SLURM_CONF"); - char *rc; - int i; - - if (!val) - return xstrdup(BLUEGENE_CONFIG_FILE); - - /* Replace file name on end of path */ - i = strlen(val) - strlen("slurm.conf") + strlen("bluegene.conf") + 1; - rc = xmalloc(i); - strcpy(rc, val); - val = strrchr(rc, (int)'/'); - if (val) /* absolute path */ - val++; - else /* not absolute path */ - val = rc; - strcpy(val, "bluegene.conf"); - return rc; -} - -/* Explicitly strip out new-line and carriage-return */ -static void _strip_13_10(char *line) -{ - int len = strlen(line); - int i; - - for(i=0;i<len;i++) { - if(line[i]==13 || line[i]==10) { - line[i] = '\0'; - return; - } - } -} - -/* - * - * _parse_bgl_spec - parse the partition specification, build table and - * set values - * IN/OUT in_line - line from the configuration file, parsed keywords - * and values replaced by blanks - * RET 0 if no error, error code otherwise - * Note: Operates on common variables - * global: part_list - global partition list pointer - * default_part - default parameters for a partition - */ -static int _parse_bgl_spec(char *in_line) -{ - int error_code = SLURM_SUCCESS; - char *nodes = NULL, *conn_type = NULL; - char *blrts_image = NULL, *linux_image = NULL; - char *mloader_image = NULL, *ramdisk_image = NULL; - char *api_file = NULL; - int pset_num=-1, api_verb=-1; - bgl_record_t *bgl_record = NULL; - bgl_record_t *small_bgl_record = NULL; - pa_node_t *pa_node = NULL; - struct passwd *pw_ent = NULL; - ListIterator itr; - int i=0; - - //info("in_line = %s",in_line); - error_code = slurm_parser(in_line, - "BlrtsImage=", 's', &blrts_image, - "LinuxImage=", 's', &linux_image, - "MloaderImage=", 's', &mloader_image, - "Numpsets=", 'd', &pset_num, - "BridgeAPIVerbose=", 'd', &api_verb, - "BridgeAPILogFile=", 's', &api_file, - "Nodes=", 's', &nodes, - "RamDiskImage=", 's', &ramdisk_image, - "Type=", 's', &conn_type, - "END"); - - if (error_code) - return SLURM_ERROR; - - /* Process system-wide info */ - if (blrts_image) { - xfree(bluegene_blrts); - bluegene_blrts = blrts_image; - blrts_image = NULL; /* nothing left to xfree */ - } - if (linux_image) { - xfree(bluegene_linux); - bluegene_linux = linux_image; - linux_image = NULL; /* nothing left to xfree */ - } - if (mloader_image) { - xfree(bluegene_mloader); - bluegene_mloader = mloader_image; - mloader_image = NULL; /* nothing left to xfree */ - } - if (ramdisk_image) { - xfree(bluegene_ramdisk); - bluegene_ramdisk = ramdisk_image; - ramdisk_image = NULL; /* nothing left to xfree */ - } - if (api_file) { - xfree(bridge_api_file); - bridge_api_file = api_file; - api_file = NULL; /* nothing left to xfree */ - } - if (pset_num > 0) { - numpsets = pset_num; - } - if (api_verb >= 0) { - bridge_api_verb = api_verb; - } - - /* Process node information */ - if (!nodes) - return SLURM_SUCCESS; /* not partition line. */ - - bgl_record = (bgl_record_t*) xmalloc(sizeof(bgl_record_t)); - - bgl_record->user_name = - xstrdup(slurmctld_conf.slurm_user_name); - if((pw_ent = getpwnam(bgl_record->user_name)) == NULL) { - error("getpwnam(%s): %m", bgl_record->user_name); - } else { - bgl_record->user_uid = pw_ent->pw_uid; - } - bgl_record->bgl_part_list = list_create(NULL); - bgl_record->hostlist = hostlist_create(NULL); - /* bgl_record->boot_state = 0; Implicit */ - /* bgl_record->state = 0; Implicit */ - - bgl_record->nodes = xstrdup(nodes); - xfree(nodes); /* pointer moved, nothing left to xfree */ - - _process_nodes(bgl_record); - if (!conn_type || !strcasecmp(conn_type,"TORUS")) - bgl_record->conn_type = SELECT_TORUS; - else if(!strcasecmp(conn_type,"MESH")) - bgl_record->conn_type = SELECT_MESH; - else - bgl_record->conn_type = SELECT_SMALL; - xfree(conn_type); - - bgl_record->node_use = SELECT_COPROCESSOR_MODE; - bgl_record->cnodes_per_bp = procs_per_node; - bgl_record->quarter = -1; - - if(bgl_record->conn_type != SELECT_SMALL) - list_append(bgl_list, bgl_record); - else { - /* Automatically create 4-way split if - * conn_type == SELECT_SMALL in bluegene.conf - */ - itr = list_iterator_create(bgl_record->bgl_part_list); - while ((pa_node = list_next(itr)) != NULL) { - for(i=0; i<4 ; i++) { - small_bgl_record = (bgl_record_t*) - xmalloc(sizeof(bgl_record_t)); - list_append(bgl_list, small_bgl_record); - - small_bgl_record->user_name = - xstrdup(bgl_record->user_name); - small_bgl_record->user_uid = - bgl_record->user_uid; - small_bgl_record->bgl_part_list = - list_create(NULL); - small_bgl_record->hostlist = - hostlist_create(NULL); - small_bgl_record->nodes = - xstrdup(bgl_record->nodes); - - _process_nodes(small_bgl_record); - - small_bgl_record->conn_type = - SELECT_SMALL; - - small_bgl_record->node_use = - SELECT_COPROCESSOR_MODE; - - small_bgl_record->cnodes_per_bp = - procs_per_node/4; - small_bgl_record->quarter = i; - } - } - list_iterator_destroy(itr); - destroy_bgl_record(bgl_record); - } - - return SLURM_SUCCESS; -} - -static void _process_nodes(bgl_record_t *bgl_record) -{ -#ifdef HAVE_BGL - int j=0, number; - int start[PA_SYSTEM_DIMENSIONS]; - int end[PA_SYSTEM_DIMENSIONS]; - ListIterator itr; - pa_node_t* pa_node = NULL; - - bgl_record->bp_count = 0; - - while (bgl_record->nodes[j] != '\0') { - if ((bgl_record->nodes[j] == '[' - || bgl_record->nodes[j] == ',') - && (bgl_record->nodes[j+8] == ']' - || bgl_record->nodes[j+8] == ',') - && (bgl_record->nodes[j+4] == 'x' - || bgl_record->nodes[j+4] == '-')) { - j++; - number = atoi(bgl_record->nodes + j); - start[X] = number / 100; - start[Y] = (number % 100) / 10; - start[Z] = (number % 10); - j += 4; - number = atoi(bgl_record->nodes + j); - end[X] = number / 100; - end[Y] = (number % 100) / 10; - end[Z] = (number % 10); - j += 3; - if(!bgl_record->bp_count) { - bgl_record->start[X] = start[X]; - bgl_record->start[Y] = start[Y]; - bgl_record->start[Z] = start[Z]; - debug2("start is %d%d%d", - bgl_record->start[X], - bgl_record->start[Y], - bgl_record->start[Z]); - } - bgl_record->bp_count += _addto_node_list(bgl_record, - start, - end); - if(bgl_record->nodes[j] != ',') - break; - j--; - } else if((bgl_record->nodes[j] < 58 - && bgl_record->nodes[j] > 47)) { - - number = atoi(bgl_record->nodes + j); - start[X] = number / 100; - start[Y] = (number % 100) / 10; - start[Z] = (number % 10); - j+=3; - if(!bgl_record->bp_count) { - bgl_record->start[X] = start[X]; - bgl_record->start[Y] = start[Y]; - bgl_record->start[Z] = start[Z]; - debug2("start is %d%d%d", - bgl_record->start[X], - bgl_record->start[Y], - bgl_record->start[Z]); - } - bgl_record->bp_count += _addto_node_list(bgl_record, - start, - start); - if(bgl_record->nodes[j] != ',') - break; - } - j++; - } - j=0; - bgl_record->geo[X] = 0; - bgl_record->geo[Y] = 0; - bgl_record->geo[Z] = 0; - end[X] = -1; - end[Y] = -1; - end[Z] = -1; - - itr = list_iterator_create(bgl_record->bgl_part_list); - while ((pa_node = list_next(itr)) != NULL) { - if(pa_node->coord[X]>end[X]) { - bgl_record->geo[X]++; - end[X] = pa_node->coord[X]; - } - if(pa_node->coord[Y]>end[Y]) { - bgl_record->geo[Y]++; - end[Y] = pa_node->coord[Y]; - } - if(pa_node->coord[Z]>end[Z]) { - bgl_record->geo[Z]++; - end[Z] = pa_node->coord[Z]; - } - } - list_iterator_destroy(itr); - debug3("geo = %d%d%d\n", - bgl_record->geo[X], - bgl_record->geo[Y], - bgl_record->geo[Z]); - -#ifndef HAVE_BGL_FILES - max_dim[X] = MAX(max_dim[X], end[X]); - max_dim[Y] = MAX(max_dim[Y], end[Y]); - max_dim[Z] = MAX(max_dim[Z], end[Z]); -#endif - - if (node_name2bitmap(bgl_record->nodes, - false, - &bgl_record->bitmap)) { - error("Unable to convert nodes %s to bitmap", - bgl_record->nodes); - } -#endif - return; -} - -static int _reopen_bridge_log(void) -{ - static FILE *fp = NULL; - - if (bridge_api_file == NULL) - return SLURM_SUCCESS; - - if(fp) - fclose(fp); - fp = fopen(bridge_api_file,"a"); - if (fp == NULL) { - error("can't open file for bridgeapi.log at %s: %m", - bridge_api_file); - return SLURM_ERROR; - } - -#ifdef HAVE_BGL_FILES - setSayMessageParams(fp, bridge_api_verb); -#else - if (fprintf(fp, "bridgeapi.log to write here at level %d\n", - bridge_api_verb) < 20) { - error("can't write to bridgeapi.log: %m"); - return SLURM_ERROR; - } -#endif - - return SLURM_SUCCESS; -} - diff --git a/src/plugins/select/bluegene/partition_sys.c b/src/plugins/select/bluegene/partition_sys.c deleted file mode 100755 index 4c7ac659e5326b1fb86e62874b9fb55dd030a7ba..0000000000000000000000000000000000000000 --- a/src/plugins/select/bluegene/partition_sys.c +++ /dev/null @@ -1,547 +0,0 @@ -/*****************************************************************************\ - * partition_sys.c - component used for wiring up the partitions - * - * $Id$ - ***************************************************************************** - * Copyright (C) 2004 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Dan Phung <phung4@llnl.gov> and Danny Auble <da@llnl.gov> - * - * This file is part of SLURM, a resource management program. - * For details, see <http://www.llnl.gov/linux/slurm/>. - * - * SLURM is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along - * with SLURM; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -\*****************************************************************************/ - -#include "bluegene.h" - - -/** these are used in the dynamic partitioning algorithm */ - -/* global system = list of free partitions */ -List bgl_sys_free = NULL; -/* global system = list of allocated partitions */ -List bgl_sys_allocated = NULL; - -/* static void _init_sys(partition_t*); */ - - /** - * _get_bp: get the BP at location loc - * - * IN - bgl: pointer to preinitialized bgl pointer - * IN - bp: pointer to preinitailized rm_element_t that will - * hold the BP that we resolve to. - * IN - loc: location of the desired BP - * OUT - bp: will point to BP at location loc - * OUT - rc: error code (0 = success) - */ -#ifdef HAVE_BGL_FILES -static void _pre_allocate(bgl_record_t *bgl_record); -static int _post_allocate(bgl_record_t *bgl_record); -static int _post_bgl_init_read(void *object, void *arg); -static int _split_block(bgl_record_t *bgl_record); - -#define MAX_ADD_RETRY 2 - -#if 0 -/* Vestigial - * print out a list - */ -static void _print_list(List list) -{ - int* stuff = NULL, i = 0; - ListIterator itr; - - if (list == NULL) - return; - - debug("trying to get the list iterator"); - itr = list_iterator_create(list); - debug("done"); - - debug("printing list"); - while ((stuff = (int*) list_next(itr))) { - debug("stuff %d", stuff); - if (stuff == NULL){ - break; - } - - debug("[ %d", stuff[0]); - for (i=1; i<PA_SYSTEM_DIMENSIONS; i++){ - debug(" x %d", stuff[i]); - } - debug(" ]"); - } - list_iterator_destroy(itr); -} -#endif - -/** - * initialize the BGL partition in the resource manager - */ -static void _pre_allocate(bgl_record_t *bgl_record) -{ - int rc; - int send_psets=numpsets; - - if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionBlrtsImg, - bluegene_blrts)) != STATUS_OK) - error("rm_set_data(RM_PartitionBlrtsImg)", bgl_err_str(rc)); - - if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionLinuxImg, - bluegene_linux)) != STATUS_OK) - error("rm_set_data(RM_PartitionLinuxImg)", bgl_err_str(rc)); - - if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionMloaderImg, - bluegene_mloader)) != STATUS_OK) - error("rm_set_data(RM_PartitionMloaderImg)", bgl_err_str(rc)); - - if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionRamdiskImg, - bluegene_ramdisk)) != STATUS_OK) - error("rm_set_data(RM_PartitionRamdiskImg)", bgl_err_str(rc)); - - if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionConnection, - &bgl_record->conn_type)) != STATUS_OK) - error("rm_set_data(RM_PartitionConnection)", bgl_err_str(rc)); - - if(bgl_record->cnodes_per_bp == (procs_per_node/4)) - send_psets = numpsets/4; - - if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionPsetsPerBP, - &send_psets)) != STATUS_OK) - error("rm_set_data(RM_PartitionPsetsPerBP)", bgl_err_str(rc)); - - if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionUserName, - slurmctld_conf.slurm_user_name)) != STATUS_OK) - error("rm_set_data(RM_PartitionUserName)", bgl_err_str(rc)); -/* info("setting it here"); */ -/* bgl_record->bgl_part_id = "RMP101"; */ -/* if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionID, */ -/* &bgl_record->bgl_part_id)) != STATUS_OK) */ -/* error("rm_set_data(RM_PartitionID)", bgl_err_str(rc)); */ -} - -/** - * add the partition record to the DB - */ -static int _post_allocate(bgl_record_t *bgl_record) -{ - int rc, i; - pm_partition_id_t part_id; - struct passwd *pw_ent = NULL; - /* Add partition record to the DB */ - debug("adding partition\n"); - - for(i=0;i<MAX_ADD_RETRY; i++) { - if ((rc = rm_add_partition(bgl_record->bgl_part)) - != STATUS_OK) { - error("rm_add_partition(): %s", bgl_err_str(rc)); - rc = SLURM_ERROR; - } else { - rc = SLURM_SUCCESS; - break; - } - sleep(3); - } - if(rc == SLURM_ERROR) { - if ((rc = rm_free_partition(bgl_record->bgl_part)) - != STATUS_OK) - error("rm_free_partition(): %s", bgl_err_str(rc)); - fatal("couldn't add last partition."); - } - debug("done adding\n"); - - /* Get back the new partition id */ - if ((rc = rm_get_data(bgl_record->bgl_part, RM_PartitionID, &part_id)) - != STATUS_OK) { - error("rm_get_data(RM_PartitionID): %s", bgl_err_str(rc)); - bgl_record->bgl_part_id = xstrdup("UNKNOWN"); - } else { - if(!part_id) { - error("No Partition ID was returned from database"); - return SLURM_ERROR; - } - bgl_record->bgl_part_id = xstrdup(part_id); - - free(part_id); - - xfree(bgl_record->target_name); - bgl_record->target_name = - xstrdup(slurmctld_conf.slurm_user_name); - - xfree(bgl_record->user_name); - bgl_record->user_name = - xstrdup(slurmctld_conf.slurm_user_name); - - if((pw_ent = getpwnam(bgl_record->user_name)) == NULL) { - error("getpwnam(%s): %m", bgl_record->user_name); - } else { - bgl_record->user_uid = pw_ent->pw_uid; - } - last_bgl_update = time(NULL); - - } - /* We are done with the partition */ - if ((rc = rm_free_partition(bgl_record->bgl_part)) != STATUS_OK) - error("rm_free_partition(): %s", bgl_err_str(rc)); - return rc; -} - -static int _post_bgl_init_read(void *object, void *arg) -{ - bgl_record_t *bgl_record = (bgl_record_t *) object; - int i = 1024; - bgl_record->nodes = xmalloc(i); - while (hostlist_ranged_string(bgl_record->hostlist, i, - bgl_record->nodes) < 0) { - i *= 2; - xrealloc(bgl_record->nodes, i); - } - - if (node_name2bitmap(bgl_record->nodes, - false, - &bgl_record->bitmap)) { - error("Unable to convert nodes %s to bitmap", - bgl_record->nodes); - } - //print_bgl_record(bgl_record); - - return SLURM_SUCCESS; -} - -extern int configure_partition(bgl_record_t *bgl_record) -{ - /* new partition to be added */ - rm_new_partition(&bgl_record->bgl_part); - _pre_allocate(bgl_record); - if(bgl_record->cnodes_per_bp < procs_per_node) - configure_small_partition(bgl_record); - else - configure_partition_switches(bgl_record); - - _post_allocate(bgl_record); - return 1; -} - -/* - * Download from MMCS the initial BGL partition information - */ -int read_bgl_partitions() -{ - int rc = SLURM_SUCCESS; - - int bp_cnt, i; - rm_element_t *bp_ptr = NULL; - rm_bp_id_t bpid; - rm_partition_t *part_ptr = NULL; - char node_name_tmp[7], *user_name = NULL; - bgl_record_t *bgl_record = NULL; - struct passwd *pw_ent = NULL; - - int *coord; - int part_number, part_count; - char *part_name = NULL; - rm_partition_list_t *part_list = NULL; - rm_partition_state_flag_t state = PARTITION_ALL_FLAG; - rm_nodecard_t *ncard = NULL; - bool small = false; - - if ((rc = rm_set_serial(BGL_SERIAL)) != STATUS_OK) { - error("rm_set_serial(): %s\n", bgl_err_str(rc)); - return SLURM_ERROR; - } - set_bp_map(); - if ((rc = rm_get_partitions_info(state, &part_list)) - != STATUS_OK) { - error("rm_get_partitions_info(): %s", bgl_err_str(rc)); - return SLURM_ERROR; - - } - - if ((rc = rm_get_data(part_list, RM_PartListSize, &part_count)) - != STATUS_OK) { - error("rm_get_data(RM_PartListSize): %s", bgl_err_str(rc)); - part_count = 0; - } - - for(part_number=0; part_number<part_count; part_number++) { - - if (part_number) { - if ((rc = rm_get_data(part_list, RM_PartListNextPart, - &part_ptr)) != STATUS_OK) { - error("rm_get_data(RM_PartListNextPart): %s", - bgl_err_str(rc)); - break; - } - } else { - if ((rc = rm_get_data(part_list, RM_PartListFirstPart, - &part_ptr)) != STATUS_OK) { - error("rm_get_data(RM_PartListFirstPart): %s", - bgl_err_str(rc)); - break; - } - } - - if ((rc = rm_get_data(part_ptr, RM_PartitionID, &part_name)) - != STATUS_OK) { - error("rm_get_data(RM_PartitionID): %s", - bgl_err_str(rc)); - continue; - } - - if(!part_name) { - error("No Partition ID was returned from database"); - continue; - } - - if(strncmp("RMP", part_name, 3)) { - free(part_name); - continue; - } - if(bgl_recover) - if ((rc = rm_get_partition(part_name, &part_ptr)) - != STATUS_OK) { - error("Partition %s doesn't exist.", - part_name); - rc = SLURM_ERROR; - free(part_name); - break; - } - /* New BGL partition record */ - - bgl_record = xmalloc(sizeof(bgl_record_t)); - list_push(bgl_curr_part_list, bgl_record); - - bgl_record->bgl_part_id = xstrdup(part_name); - - free(part_name); - - bgl_record->state = -1; - bgl_record->quarter = -1; - - if ((rc = rm_get_data(part_ptr, - RM_PartitionBPNum, - &bp_cnt)) - != STATUS_OK) { - error("rm_get_data(RM_BPNum): %s", - bgl_err_str(rc)); - bp_cnt = 0; - } - - if(bp_cnt==0) - goto clean_up; - - if ((rc = rm_get_data(part_ptr, RM_PartitionSmall, &small)) - != STATUS_OK) { - error("rm_get_data(RM_BPNum): %s", bgl_err_str(rc)); - bp_cnt = 0; - } - if(small) { - if((rc = rm_get_data(part_ptr, - RM_PartitionFirstNodeCard, - &ncard)) - != STATUS_OK) { - error("rm_get_data(RM_FirstCard): %s", - bgl_err_str(rc)); - bp_cnt = 0; - } - if ((rc = rm_get_data(ncard, - RM_NodeCardQuarter, - &bgl_record->quarter)) != STATUS_OK) { - error("rm_get_data(CardQuarter): %d",rc); - bp_cnt = 0; - } - debug("%s is in quarter %d", - bgl_record->bgl_part_id, - bgl_record->quarter); - } - - bgl_record->bgl_part_list = list_create(NULL); - bgl_record->hostlist = hostlist_create(NULL); - - /* this needs to be changed for small partitions, - we just don't know what they are suppose to look - like just yet. - */ - - for (i=0; i<bp_cnt; i++) { - if(i) { - if ((rc = rm_get_data(part_ptr, - RM_PartitionNextBP, - &bp_ptr)) - != STATUS_OK) { - error("rm_get_data(RM_NextBP): %s", - bgl_err_str(rc)); - rc = SLURM_ERROR; - break; - } - } else { - if ((rc = rm_get_data(part_ptr, - RM_PartitionFirstBP, - &bp_ptr)) - != STATUS_OK) { - error("rm_get_data(RM_FirstBP): %s", - bgl_err_str(rc)); - rc = SLURM_ERROR; - if (bgl_recover) - rm_free_partition(part_ptr); - return rc; - } - } - if ((rc = rm_get_data(bp_ptr, RM_BPID, &bpid)) - != STATUS_OK) { - error("rm_get_data(RM_BPLoc): %s", - bgl_err_str(rc)); - rc = SLURM_ERROR; - break; - } - - if(!bpid) { - error("No BP ID was returned from database"); - continue; - } - - coord = find_bp_loc(bpid); - - free(bpid); - - if(!coord) - fatal("No contact with db2. Shutting down."); - - snprintf(node_name_tmp, sizeof(node_name_tmp), - "bgl%d%d%d", - coord[X], coord[Y], coord[Z]); - - hostlist_push(bgl_record->hostlist, node_name_tmp); - } - - // need to get the 000x000 range for nodes - // also need to get coords - if(small) - bgl_record->conn_type = SELECT_SMALL; - else - if ((rc = rm_get_data(part_ptr, - RM_PartitionConnection, - &bgl_record->conn_type)) - != STATUS_OK) { - error("rm_get_data" - "(RM_PartitionConnection): %s", - bgl_err_str(rc)); - } - if ((rc = rm_get_data(part_ptr, RM_PartitionMode, - &bgl_record->node_use)) - != STATUS_OK) { - error("rm_get_data(RM_PartitionMode): %s", - bgl_err_str(rc)); - } - - if ((rc = rm_get_data(part_ptr, RM_PartitionState, - &bgl_record->state)) != STATUS_OK) { - error("rm_get_data(RM_PartitionState): %s", - bgl_err_str(rc)); - } else if(bgl_record->state == RM_PARTITION_CONFIGURING) - bgl_record->boot_state = 1; - else - bgl_record->boot_state = 0; - - debug("Partition %s is in state %d", - bgl_record->bgl_part_id, - bgl_record->state); - - if ((rc = rm_get_data(part_ptr, RM_PartitionUsersNum, - &bp_cnt)) != STATUS_OK) { - error("rm_get_data(RM_PartitionUsersNum): %s", - bgl_err_str(rc)); - } else { - if(bp_cnt==0) { - bgl_record->user_name = - xstrdup(slurmctld_conf. - slurm_user_name); - bgl_record->target_name = - xstrdup(slurmctld_conf. - slurm_user_name); - } else { - user_name = NULL; - if ((rc = rm_get_data(part_ptr, - RM_PartitionFirstUser, - &user_name)) - != STATUS_OK) { - error("rm_get_data" - "(RM_PartitionFirstUser): %s", - bgl_err_str(rc)); - } - if(!user_name) { - error("No user name was " - "returned from database"); - goto clean_up; - } - bgl_record->user_name = xstrdup(user_name); - - if(!bgl_record->boot_state) - bgl_record->target_name = - xstrdup(slurmctld_conf. - slurm_user_name); - else - bgl_record->target_name = - xstrdup(user_name); - - free(user_name); - - } - if((pw_ent = getpwnam(bgl_record->user_name)) - == NULL) { - error("getpwnam(%s): %m", - bgl_record->user_name); - } else { - bgl_record->user_uid = pw_ent->pw_uid; - } - } - - if ((rc = rm_get_data(part_ptr, RM_PartitionBPNum, - &bgl_record->bp_count)) != STATUS_OK) { - error("rm_get_data(RM_PartitionBPNum): %s", - bgl_err_str(rc)); - } - debug("has %d BPs", - bgl_record->bp_count); - - if ((rc = rm_get_data(part_ptr, RM_PartitionSwitchNum, - &bgl_record->switch_count)) != STATUS_OK) { - error("rm_get_data(RM_PartitionSwitchNum): %s", - bgl_err_str(rc)); - } - - if(small) - bgl_record->cnodes_per_bp = procs_per_node/4; - else - bgl_record->cnodes_per_bp = procs_per_node; - - bgl_record->part_lifecycle = STATIC; - -clean_up: if (bgl_recover - && ((rc = rm_free_partition(part_ptr)) != STATUS_OK)) { - error("rm_free_partition(): %s", bgl_err_str(rc)); - } - } - rm_free_partition_list(part_list); - - /* perform post-processing for each bluegene partition */ - if(bgl_recover) - list_for_each(bgl_curr_part_list, _post_bgl_init_read, NULL); - return rc; -} - -#endif - diff --git a/src/plugins/select/bluegene/plugin/Makefile.am b/src/plugins/select/bluegene/plugin/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..890b2bc89fb1511d85fe23633e5213aa4fd6a4c9 --- /dev/null +++ b/src/plugins/select/bluegene/plugin/Makefile.am @@ -0,0 +1,41 @@ +# $Id$ +# Makefile for select/bluegene plugin + +CPPFLAGS = -DBLUEGENE_CONFIG_FILE=\"$(sysconfdir)/bluegene.conf\" +AUTOMAKE_OPTIONS = foreign + +PLUGIN_FLAGS = -module -avoid-version --export-dynamic -lm + +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common $(BG_INCLUDES) + +pkglib_LTLIBRARIES = select_bluegene.la + +# Blue Gene node selection plugin. +select_bluegene_la_SOURCES = select_bluegene.c \ + bg_job_place.c bg_job_place.h \ + bg_job_run.c bg_job_run.h \ + bg_block_info.c bg_block_info.h \ + bluegene.c bluegene.h \ + state_test.c state_test.h \ + bg_switch_connections.c \ + block_sys.c \ + wrap_rm_api.h + +select_bluegene_la_LDFLAGS = $(SO_LDFLAGS) $(PLUGIN_FLAGS) + +select_bluegene_la_LIBADD = ../block_allocator/libbluegene_block_allocator.la + +sbin_PROGRAMS = slurm_prolog slurm_epilog sfree + +sfree_LDADD = $(top_builddir)/src/common/libcommon.la \ + $(top_builddir)/src/api/libslurm.la +slurm_prolog_LDADD = $(top_builddir)/src/common/libcommon.la \ + $(top_builddir)/src/api/libslurm.la +slurm_epilog_LDADD = $(top_builddir)/src/common/libcommon.la \ + $(top_builddir)/src/api/libslurm.la +sfree_SOURCES = sfree.c sfree.h opts.c +slurm_prolog_SOURCES = slurm_prolog.c +slurm_epilog_SOURCES = slurm_epilog.c +sfree_LDFLAGS = -export-dynamic -lm $(CMD_LDFLAGS) $(BG_LDFLAGS) +slurm_prolog_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) +slurm_epilog_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) diff --git a/src/plugins/select/bluegene/Manifest b/src/plugins/select/bluegene/plugin/Manifest similarity index 100% rename from src/plugins/select/bluegene/Manifest rename to src/plugins/select/bluegene/plugin/Manifest diff --git a/src/plugins/select/bluegene/bgl_part_info.c b/src/plugins/select/bluegene/plugin/bg_block_info.c similarity index 57% rename from src/plugins/select/bluegene/bgl_part_info.c rename to src/plugins/select/bluegene/plugin/bg_block_info.c index 84c009d853a8f24acb398d728c086a53a253e89a..4a8850c9a2d91c4a667d60b44a681d699025ed76 100644 --- a/src/plugins/select/bluegene/bgl_part_info.c +++ b/src/plugins/select/bluegene/plugin/bg_block_info.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * bgl_part_info.c - blue gene partition information from the db2 database. + * bg_block_info.c - blue gene partition information from the db2 database. * * $Id$ ***************************************************************************** @@ -58,56 +58,56 @@ #define _DEBUG 0 #define RETRY_BOOT_COUNT 3 -#ifdef HAVE_BGL_FILES -static int _partition_is_deallocating(bgl_record_t *bgl_record); +#ifdef HAVE_BG_FILES +static int _block_is_deallocating(bg_record_t *bg_record); static void _drain_as_needed(char *node_list, char *reason); -static int _partition_is_deallocating(bgl_record_t *bgl_record) +static int _block_is_deallocating(bg_record_t *bg_record) { - if(remove_all_users(bgl_record->bgl_part_id, NULL) + if(remove_all_users(bg_record->bg_block_id, NULL) == REMOVE_USER_ERR) { error("Something happened removing " "users from partition %s", - bgl_record->bgl_part_id); + bg_record->bg_block_id); } - if(bgl_record->target_name - && bgl_record->user_name) { - if(!strcmp(bgl_record->target_name, + if(bg_record->target_name + && bg_record->user_name) { + if(!strcmp(bg_record->target_name, slurmctld_conf.slurm_user_name)) { - if(strcmp(bgl_record->target_name, - bgl_record->user_name)) { + if(strcmp(bg_record->target_name, + bg_record->user_name)) { error("Partition %s was in a ready state " "for user %s but is being freed. " "Job was lost.", - bgl_record->bgl_part_id, - bgl_record->user_name); - term_jobs_on_part(bgl_record->bgl_part_id); + bg_record->bg_block_id, + bg_record->user_name); + term_jobs_on_block(bg_record->bg_block_id); } else { debug("Partition %s was in a ready state " "but is being freed. No job running.", - bgl_record->bgl_part_id); + bg_record->bg_block_id); } } else { error("State went to free on a boot " "for partition %s.", - bgl_record->bgl_part_id); + bg_record->bg_block_id); } - } else if(bgl_record->user_name) { + } else if(bg_record->user_name) { error("Target Name was not set " "not set for partition %s.", - bgl_record->bgl_part_id); - bgl_record->target_name = - xstrdup(bgl_record->user_name); + bg_record->bg_block_id); + bg_record->target_name = + xstrdup(bg_record->user_name); } else { error("Target Name and User Name are " "not set for partition %s.", - bgl_record->bgl_part_id); - bgl_record->user_name = + bg_record->bg_block_id); + bg_record->user_name = xstrdup(slurmctld_conf.slurm_user_name); - bgl_record->target_name = - xstrdup(bgl_record->user_name); + bg_record->target_name = + xstrdup(bg_record->user_name); } return SLURM_SUCCESS; } @@ -115,7 +115,7 @@ static int _partition_is_deallocating(bgl_record_t *bgl_record) /* If any nodes in node_list are drained, draining, or down, * then just return * else drain all of the nodes - * This function lets us drain an entire bglblock only if + * This function lets us drain an entire bgblock only if * we have not already identified a specific node as bad. */ static void _drain_as_needed(char *node_list, char *reason) { @@ -149,34 +149,34 @@ static void _drain_as_needed(char *node_list, char *reason) * * NOTE: This happens in parallel with srun and slurmd spawning * the job. A prolog script is expected to defer initiation of - * the job script until the BGL block is available for use. + * the job script until the BG block is available for use. */ -extern int part_ready(struct job_record *job_ptr) +extern int block_ready(struct job_record *job_ptr) { int rc = 1; -#ifdef HAVE_BGL_FILES - char *part_id = NULL; - bgl_record_t *bgl_record = NULL; +#ifdef HAVE_BG_FILES + char *block_id = NULL; + bg_record_t *bg_record = NULL; rc = select_g_get_jobinfo(job_ptr->select_jobinfo, - SELECT_DATA_PART_ID, &part_id); + SELECT_DATA_BLOCK_ID, &block_id); if (rc == SLURM_SUCCESS) { - bgl_record = find_bgl_record(part_id); + bg_record = find_bg_record(block_id); - if(bgl_record) { - if ((bgl_record->user_uid == job_ptr->user_id) - && (bgl_record->state == RM_PARTITION_READY)) { + if(bg_record) { + if ((bg_record->user_uid == job_ptr->user_id) + && (bg_record->state == RM_PARTITION_READY)) { rc = 1; - } else if (bgl_record->user_uid != job_ptr->user_id) + } else if (bg_record->user_uid != job_ptr->user_id) rc = 0; else rc = READY_JOB_ERROR; /* try again */ } else { - error("part_ready: partition %s not in bgl_list.", - part_id); + error("block_ready: partition %s not in bg_list.", + block_id); rc = READY_JOB_FATAL; /* fatal error */ } - xfree(part_id); + xfree(block_id); } else rc = READY_JOB_ERROR; #endif @@ -184,73 +184,73 @@ extern int part_ready(struct job_record *job_ptr) } /* Pack all relevent information about a partition */ -extern void pack_partition(bgl_record_t *bgl_record, Buf buffer) +extern void pack_block(bg_record_t *bg_record, Buf buffer) { - packstr(bgl_record->nodes, buffer); - packstr(bgl_record->user_name, buffer); - packstr(bgl_record->bgl_part_id, buffer); - pack16((uint16_t)bgl_record->state, buffer); - pack16((uint16_t)bgl_record->conn_type, buffer); - pack16((uint16_t)bgl_record->node_use, buffer); - pack32(bgl_record->quarter, buffer); + packstr(bg_record->nodes, buffer); + packstr(bg_record->user_name, buffer); + packstr(bg_record->bg_block_id, buffer); + pack16((uint16_t)bg_record->state, buffer); + pack16((uint16_t)bg_record->conn_type, buffer); + pack16((uint16_t)bg_record->node_use, buffer); + pack32(bg_record->quarter, buffer); } -extern int update_partition_list() +extern int update_block_list() { int updated = 0; -#ifdef HAVE_BGL_FILES - int j, rc, num_parts = 0; - rm_partition_t *part_ptr = NULL; +#ifdef HAVE_BG_FILES + int j, rc, num_blocks = 0; + rm_partition_t *block_ptr = NULL; rm_partition_mode_t node_use; rm_partition_state_t state; - rm_partition_state_flag_t part_state = PARTITION_ALL_FLAG; + rm_partition_state_flag_t block_state = PARTITION_ALL_FLAG; char *name = NULL; - rm_partition_list_t *part_list = NULL; - bgl_record_t *bgl_record = NULL; + rm_partition_list_t *block_list = NULL; + bg_record_t *bg_record = NULL; //struct passwd *pw_ent = NULL; time_t now; struct tm *time_ptr; char reason[128]; int skipped_dealloc = 0; - if(!partitions_are_created) + if(!blocks_are_created) return 0; - if ((rc = rm_get_partitions_info(part_state, &part_list)) + if ((rc = rm_get_partitions_info(block_state, &block_list)) != STATUS_OK) { - error("rm_get_partitions_info(): %s", bgl_err_str(rc)); + error("rm_get_partitions_info(): %s", bg_err_str(rc)); return -1; } - if ((rc = rm_get_data(part_list, RM_PartListSize, &num_parts)) + if ((rc = rm_get_data(block_list, RM_PartListSize, &num_blocks)) != STATUS_OK) { - error("rm_get_data(RM_PartListSize): %s", bgl_err_str(rc)); + error("rm_get_data(RM_PartListSize): %s", bg_err_str(rc)); updated = -1; - num_parts = 0; + num_blocks = 0; } - for (j=0; j<num_parts; j++) { + for (j=0; j<num_blocks; j++) { if (j) { - if ((rc = rm_get_data(part_list, RM_PartListNextPart, - &part_ptr)) != STATUS_OK) { + if ((rc = rm_get_data(block_list, RM_PartListNextPart, + &block_ptr)) != STATUS_OK) { error("rm_get_data(RM_PartListNextPart): %s", - bgl_err_str(rc)); + bg_err_str(rc)); updated = -1; break; } } else { - if ((rc = rm_get_data(part_list, RM_PartListFirstPart, - &part_ptr)) != STATUS_OK) { + if ((rc = rm_get_data(block_list, RM_PartListFirstPart, + &block_ptr)) != STATUS_OK) { error("rm_get_data(RM_PartListFirstPart: %s", - bgl_err_str(rc)); + bg_err_str(rc)); updated = -1; break; } } - if ((rc = rm_get_data(part_ptr, RM_PartitionID, &name)) + if ((rc = rm_get_data(block_ptr, RM_PartitionID, &name)) != STATUS_OK) { error("rm_get_data(RM_PartitionID): %s", - bgl_err_str(rc)); + bg_err_str(rc)); updated = -1; break; } @@ -262,12 +262,12 @@ extern int update_partition_list() free(name); continue; } - bgl_record = find_bgl_record(name); + bg_record = find_bg_record(name); - if(bgl_record == NULL) { - error("Partition %s not found in bgl_list " + if(bg_record == NULL) { + error("Partition %s not found in bg_list " "removing from database", name); - term_jobs_on_part(name); + term_jobs_on_block(name); if ((rc = pm_destroy_partition(name)) != STATUS_OK) { if(rc == PARTITION_NOT_FOUND) { @@ -278,13 +278,13 @@ extern int update_partition_list() } error("pm_destroy_partition(%s): %s", name, - bgl_err_str(rc)); + bg_err_str(rc)); } rc = rm_remove_partition(name); if (rc != STATUS_OK) { error("rm_remove_partition(%s): %s", name, - bgl_err_str(rc)); + bg_err_str(rc)); } else debug("done\n"); free(name); @@ -292,117 +292,117 @@ extern int update_partition_list() } free(name); - slurm_mutex_lock(&part_state_mutex); + slurm_mutex_lock(&block_state_mutex); - if ((rc = rm_get_data(part_ptr, RM_PartitionMode, &node_use)) + if ((rc = rm_get_data(block_ptr, RM_PartitionMode, &node_use)) != STATUS_OK) { error("rm_get_data(RM_PartitionMode): %s", - bgl_err_str(rc)); + bg_err_str(rc)); updated = -1; - slurm_mutex_unlock(&part_state_mutex); + slurm_mutex_unlock(&block_state_mutex); break; - } else if(bgl_record->node_use != node_use) { + } else if(bg_record->node_use != node_use) { debug("node_use of Partition %s was %d and now is %d", - bgl_record->bgl_part_id, - bgl_record->node_use, + bg_record->bg_block_id, + bg_record->node_use, node_use); - bgl_record->node_use = node_use; + bg_record->node_use = node_use; updated = 1; } - if ((rc = rm_get_data(part_ptr, RM_PartitionState, &state)) + if ((rc = rm_get_data(block_ptr, RM_PartitionState, &state)) != STATUS_OK) { error("rm_get_data(RM_PartitionState): %s", - bgl_err_str(rc)); + bg_err_str(rc)); updated = -1; - slurm_mutex_unlock(&part_state_mutex); + slurm_mutex_unlock(&block_state_mutex); break; - } else if(bgl_record->state != state) { + } else if(bg_record->state != state) { debug("state of Partition %s was %d and now is %d", - bgl_record->bgl_part_id, - bgl_record->state, + bg_record->bg_block_id, + bg_record->state, state); /* check to make sure partition went through freeing correctly */ - if(bgl_record->state != RM_PARTITION_DEALLOCATING + if(bg_record->state != RM_PARTITION_DEALLOCATING && state == RM_PARTITION_FREE) skipped_dealloc = 1; - bgl_record->state = state; - if(bgl_record->state == RM_PARTITION_DEALLOCATING) { - _partition_is_deallocating(bgl_record); + bg_record->state = state; + if(bg_record->state == RM_PARTITION_DEALLOCATING) { + _block_is_deallocating(bg_record); } else if(skipped_dealloc) { - _partition_is_deallocating(bgl_record); + _block_is_deallocating(bg_record); skipped_dealloc = 0; - } else if(bgl_record->state + } else if(bg_record->state == RM_PARTITION_CONFIGURING) - bgl_record->boot_state = 1; + bg_record->boot_state = 1; updated = 1; } /* check the boot state */ /* debug("boot state for partition %s is %d", */ -/* bgl_record->bgl_part_id, */ -/* bgl_record->boot_state); */ - if(bgl_record->boot_state == 1) { - switch(bgl_record->state) { +/* bg_record->bg_block_id, */ +/* bg_record->boot_state); */ + if(bg_record->boot_state == 1) { + switch(bg_record->state) { case RM_PARTITION_CONFIGURING: debug("checking to make sure user %s " "is the user.", - bgl_record->target_name); - if(update_partition_user(bgl_record) == 1) - last_bgl_update = time(NULL); + bg_record->target_name); + if(update_block_user(bg_record) == 1) + last_bg_update = time(NULL); break; case RM_PARTITION_ERROR: error("partition in an error state"); case RM_PARTITION_FREE: - if(bgl_record->boot_count < RETRY_BOOT_COUNT) { - slurm_mutex_unlock(&part_state_mutex); - if((rc = boot_part(bgl_record)) + if(bg_record->boot_count < RETRY_BOOT_COUNT) { + slurm_mutex_unlock(&block_state_mutex); + if((rc = boot_block(bg_record)) != SLURM_SUCCESS) { updated = -1; } - slurm_mutex_lock(&part_state_mutex); + slurm_mutex_lock(&block_state_mutex); debug("boot count for partition %s " " is %d", - bgl_record->bgl_part_id, - bgl_record->boot_count); - bgl_record->boot_count++; + bg_record->bg_block_id, + bg_record->boot_count); + bg_record->boot_count++; } else { error("Couldn't boot Partition %s " "for user %s", - bgl_record->bgl_part_id, - bgl_record->target_name); + bg_record->bg_block_id, + bg_record->target_name); now = time(NULL); time_ptr = localtime(&now); strftime(reason, sizeof(reason), - "update_partition_list: " + "update_block_list: " "Boot fails " "[SLURM@%b %d %H:%M]", time_ptr); - _drain_as_needed(bgl_record->nodes, + _drain_as_needed(bg_record->nodes, reason); - bgl_record->boot_state = 0; - bgl_record->boot_count = 0; + bg_record->boot_state = 0; + bg_record->boot_count = 0; } break; case RM_PARTITION_READY: debug("partition %s is ready.", - bgl_record->bgl_part_id); - set_part_user(bgl_record); + bg_record->bg_block_id); + set_block_user(bg_record); break; default: debug("Hey the state of the Partition is %d " - "doing nothing.",bgl_record->state); + "doing nothing.",bg_record->state); break; } } - slurm_mutex_unlock(&part_state_mutex); + slurm_mutex_unlock(&block_state_mutex); } - if ((rc = rm_free_partition_list(part_list)) != STATUS_OK) { - error("rm_free_partition_list(): %s", bgl_err_str(rc)); + if ((rc = rm_free_partition_list(block_list)) != STATUS_OK) { + error("rm_free_partition_list(): %s", bg_err_str(rc)); } #endif return updated; diff --git a/src/plugins/select/bluegene/bgl_part_info.h b/src/plugins/select/bluegene/plugin/bg_block_info.h similarity index 83% rename from src/plugins/select/bluegene/bgl_part_info.h rename to src/plugins/select/bluegene/plugin/bg_block_info.h index 598308432a971d17029536754f58840c5525d62a..5143a30a0639095c87265641d45506e3b15804c3 100644 --- a/src/plugins/select/bluegene/bgl_part_info.h +++ b/src/plugins/select/bluegene/plugin/bg_block_info.h @@ -1,5 +1,5 @@ /*****************************************************************************\ - * bgl_part_info.h - header for blue gene partition information. + * bg_part_info.h - header for blue gene partition information. ***************************************************************************** * Copyright (C) 2004 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -23,14 +23,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. \*****************************************************************************/ -#ifndef _BGL_PART_INFO_H_ -#define _BGL_PART_INFO_H_ +#ifndef _BG_PART_INFO_H_ +#define _BG_PART_INFO_H_ #include "bluegene.h" /*****************************************************/ extern int part_ready(struct job_record *job_ptr); -extern void pack_partition(bgl_record_t *bgl_record, Buf buffer); -extern int unpack_partition(bgl_info_record_t *bgl_info_record, Buf buffer); +extern void pack_partition(bg_record_t *bg_record, Buf buffer); +extern int unpack_partition(bg_info_record_t *bg_info_record, Buf buffer); extern int update_partition_list(); -#endif /* _BGL_PART_INFO_H_ */ +#endif /* _BG_PART_INFO_H_ */ diff --git a/src/plugins/select/bluegene/bgl_job_place.c b/src/plugins/select/bluegene/plugin/bg_job_place.c similarity index 73% rename from src/plugins/select/bluegene/bgl_job_place.c rename to src/plugins/select/bluegene/plugin/bg_job_place.c index 6e1358bd1ba2460f10acb9a6797f3d01fc69fddb..9560d383590d9c249aa182f37bc6ca8a84a7ce6c 100644 --- a/src/plugins/select/bluegene/bgl_job_place.c +++ b/src/plugins/select/bluegene/plugin/bg_job_place.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * bgl_job_place.c - blue gene job placement (e.g. base partition selection) + * bg_job_place.c - blue gene job placement (e.g. base block selection) * functions. * * $Id$ @@ -41,10 +41,10 @@ _STMT_START { \ (b) = (t); \ } _STMT_END -static int _find_best_partition_match(struct job_record* job_ptr, - bitstr_t* slurm_part_bitmap, +static int _find_best_block_match(struct job_record* job_ptr, + bitstr_t* slurm_block_bitmap, int min_nodes, int max_nodes, - int spec, bgl_record_t** found_bgl_record); + int spec, bg_record_t** found_bg_record); static void _rotate_geo(uint16_t *req_geometry, int rot_cnt); /* Rotate a 3-D geometry array through its six permutations */ @@ -81,26 +81,26 @@ static void _rotate_geo(uint16_t *req_geometry, int rot_cnt) * specification as to the importance of certain job params, for * instance, geometry, type, size, etc. * - * OUT - part_id of matched partition, NULL otherwise + * OUT - block_id of matched block, NULL otherwise * returns 1 for error (no match) * */ -static int _find_best_partition_match(struct job_record* job_ptr, - bitstr_t* slurm_part_bitmap, int min_nodes, int max_nodes, - int spec, bgl_record_t** found_bgl_record) +static int _find_best_block_match(struct job_record* job_ptr, + bitstr_t* slurm_block_bitmap, int min_nodes, int max_nodes, + int spec, bg_record_t** found_bg_record) { ListIterator itr; - bgl_record_t* record = NULL; + bg_record_t* record = NULL; int i; - uint16_t req_geometry[PA_SYSTEM_DIMENSIONS]; + uint16_t req_geometry[BA_SYSTEM_DIMENSIONS]; uint16_t conn_type, rotate, target_size = 1, checked; uint32_t req_procs = job_ptr->num_procs; int rot_cnt = 0; uint32_t proc_cnt; int job_running = 0; - if(!bgl_list) { - error("_find_best_partition_match: There is no bgl_list"); + if(!bg_list) { + error("_find_best_block_match: There is no bg_list"); return SLURM_ERROR; } @@ -112,14 +112,14 @@ static int _find_best_partition_match(struct job_record* job_ptr, we want to fall through to tell the scheduler that it is runnable just not right now. */ - if(full_system_partition->job_running && checked<2) { + if(full_system_block->job_running && checked<2) { checked++; select_g_set_jobinfo(job_ptr->select_jobinfo, SELECT_DATA_CHECKED, &checked); - debug("_find_best_partition_match none found " - "full system running on partition %s.", - full_system_partition->bgl_part_id); + debug("_find_best_block_match none found " + "full system running on block %s.", + full_system_block->bg_block_id); return SLURM_ERROR; } @@ -129,35 +129,39 @@ static int _find_best_partition_match(struct job_record* job_ptr, SELECT_DATA_GEOMETRY, req_geometry); select_g_get_jobinfo(job_ptr->select_jobinfo, SELECT_DATA_ROTATE, &rotate); - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++) + for (i=0; i<BA_SYSTEM_DIMENSIONS; i++) target_size *= req_geometry[i]; if (target_size == 0) /* no geometry specified */ target_size = min_nodes; /* this is where we should have the control flow depending on * the spec arguement */ - *found_bgl_record = NULL; + *found_bg_record = NULL; - debug("number of partitions to check: %d", list_count(bgl_list)); - itr = list_iterator_create(bgl_list); - while ((record = (bgl_record_t*) list_next(itr))) { + debug("number of blocks to check: %d", list_count(bg_list)); + itr = list_iterator_create(bg_list); + while ((record = (bg_record_t*) list_next(itr))) { /* Check processor count */ /* have to check checked to see which time the node scheduler is looking to see if it is runnable. If checked >=2 we want to fall through to tell the scheduler that it is runnable just not right now. */ + slurm_mutex_lock(&block_state_mutex); debug3("job_running = %d", record->job_running); if(record->job_running && checked<2) { job_running++; - debug("partition %s in use by %s", - record->bgl_part_id, + debug("block %s in use by %s", + record->bg_block_id, record->user_name); + slurm_mutex_unlock(&block_state_mutex); continue; } - if(record->full_partition && job_running) { - debug("Can't run on full system partition " - "another partition has a job running."); + slurm_mutex_unlock(&block_state_mutex); + + if(record->full_block && job_running) { + debug("Can't run on full system block " + "another block has a job running."); continue; } @@ -170,8 +174,8 @@ static int _find_best_partition_match(struct job_record* job_ptr, */ proc_cnt = record->bp_count * record->cnodes_per_bp; if (req_procs > proc_cnt) { - debug("partition %s CPU count too low", - record->bgl_part_id); + debug("block %s CPU count too low", + record->bg_block_id); continue; } } @@ -182,32 +186,32 @@ static int _find_best_partition_match(struct job_record* job_ptr, if ((record->bp_count < min_nodes) || (max_nodes != 0 && record->bp_count > max_nodes) || (record->bp_count < target_size)) { - debug("partition %s node count not suitable", - record->bgl_part_id); + debug("block %s node count not suitable", + record->bg_block_id); continue; } /* - * Next we check that this partition's bitmap is within + * Next we check that this block's bitmap is within * the set of nodes which the job can use. * Nodes not available for the job could be down, * drained, allocated to some other job, or in some - * SLURM partition not available to this job. + * SLURM block not available to this job. */ - if (!bit_super_set(record->bitmap, slurm_part_bitmap)) { - debug("bgl partition %s has nodes not usable by this " - "job", record->bgl_part_id); + if (!bit_super_set(record->bitmap, slurm_block_bitmap)) { + debug("bg block %s has nodes not usable by this " + "job", record->bg_block_id); continue; } /* - * Insure that any required nodes are in this BGL partition + * Insure that any required nodes are in this BG block */ if (job_ptr->details->req_node_bitmap && (!bit_super_set(job_ptr->details->req_node_bitmap, record->bitmap))) { - debug("bgl partition %s lacks required nodes", - record->bgl_part_id); + debug("bg block %s lacks required nodes", + record->bg_block_id); continue; } @@ -216,8 +220,8 @@ static int _find_best_partition_match(struct job_record* job_ptr, /***********************************************/ if ((conn_type != record->conn_type) && (conn_type != SELECT_NAV)) { - debug("bgl partition %s conn-type not usable", - record->bgl_part_id); + debug("bg block %s conn-type not usable", + record->bg_block_id); continue; } @@ -247,7 +251,7 @@ static int _find_best_partition_match(struct job_record* job_ptr, continue; /* Not usable */ } - *found_bgl_record = record; + *found_bg_record = record; break; } list_iterator_destroy(itr); @@ -256,15 +260,15 @@ static int _find_best_partition_match(struct job_record* job_ptr, SELECT_DATA_CHECKED, &checked); /* set the bitmap and do other allocation activities */ - if (*found_bgl_record) { - debug("_find_best_partition_match %s <%s>", - (*found_bgl_record)->bgl_part_id, - (*found_bgl_record)->nodes); - bit_and(slurm_part_bitmap, (*found_bgl_record)->bitmap); + if (*found_bg_record) { + debug("_find_best_block_match %s <%s>", + (*found_bg_record)->bg_block_id, + (*found_bg_record)->nodes); + bit_and(slurm_block_bitmap, (*found_bg_record)->bitmap); return SLURM_SUCCESS; } - debug("_find_best_partition_match none found"); + debug("_find_best_block_match none found"); return SLURM_ERROR; } @@ -274,16 +278,16 @@ static int _find_best_partition_match(struct job_record* job_ptr, * IN/OUT bitmap - nodes availble for assignment to job, clear those not to * be used * IN min_nodes, max_nodes - minimum and maximum number of nodes to allocate - * to this job (considers slurm partition limits) + * to this job (considers slurm block limits) * RET - SLURM_SUCCESS if job runnable now, error code otherwise */ -extern int submit_job(struct job_record *job_ptr, bitstr_t *slurm_part_bitmap, +extern int submit_job(struct job_record *job_ptr, bitstr_t *slurm_block_bitmap, int min_nodes, int max_nodes) { int spec = 1; /* this will be like, keep TYPE a priority, etc, */ - bgl_record_t* record = NULL; + bg_record_t* record = NULL; char buf[100]; - char bgl_part_id[BITSIZE]; + char bg_block_id[BITSIZE]; select_g_sprint_jobinfo(job_ptr->select_jobinfo, buf, sizeof(buf), SELECT_PRINT_MIXED); @@ -292,14 +296,14 @@ extern int submit_job(struct job_record *job_ptr, bitstr_t *slurm_part_bitmap, min_nodes, max_nodes); - if ((_find_best_partition_match(job_ptr, slurm_part_bitmap, min_nodes, + if ((_find_best_block_match(job_ptr, slurm_block_bitmap, min_nodes, max_nodes, spec, &record)) == SLURM_ERROR) { return SLURM_ERROR; } else { - /* we place the part_id into the env of the script to run */ - snprintf(bgl_part_id, BITSIZE, "%s", record->bgl_part_id); + /* we place the block_id into the env of the script to run */ + snprintf(bg_block_id, BITSIZE, "%s", record->bg_block_id); select_g_set_jobinfo(job_ptr->select_jobinfo, - SELECT_DATA_PART_ID, bgl_part_id); + SELECT_DATA_BLOCK_ID, bg_block_id); } return SLURM_SUCCESS; diff --git a/src/plugins/select/bluegene/bgl_job_place.h b/src/plugins/select/bluegene/plugin/bg_job_place.h similarity index 91% rename from src/plugins/select/bluegene/bgl_job_place.h rename to src/plugins/select/bluegene/plugin/bg_job_place.h index 243e55e850285e63a44d1eb6f7d7d128e29e1ab3..f68e857af2c3ebd7ab91ea87b57a355b06c4e33b 100644 --- a/src/plugins/select/bluegene/bgl_job_place.h +++ b/src/plugins/select/bluegene/plugin/bg_job_place.h @@ -1,5 +1,5 @@ /*****************************************************************************\ - * bgl_job_place.h - header for blue gene job placement (e.g. base partition + * bg_job_place.h - header for blue gene job placement (e.g. base partition * selection) functions. ***************************************************************************** * Copyright (C) 2004 The Regents of the University of California. @@ -24,8 +24,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. \*****************************************************************************/ -#ifndef _BGL_JOB_PLACE_H_ -#define _BGL_JOB_PLACE_H_ +#ifndef _BG_JOB_PLACE_H_ +#define _BG_JOB_PLACE_H_ #include "src/slurmctld/slurmctld.h" @@ -41,4 +41,4 @@ extern int submit_job(struct job_record *job_ptr, bitstr_t *bitmap, int min_nodes, int max_nodes); -#endif /* _BGL_JOB_PLACE_H_ */ +#endif /* _BG_JOB_PLACE_H_ */ diff --git a/src/plugins/select/bluegene/bgl_job_run.c b/src/plugins/select/bluegene/plugin/bg_job_run.c similarity index 55% rename from src/plugins/select/bluegene/bgl_job_run.c rename to src/plugins/select/bluegene/plugin/bg_job_run.c index 8b6a7d79ca4cec3abf627a904bea0972291e8521..e476c31d31ab2c8cae1e415163bb6ffa3de0caba 100644 --- a/src/plugins/select/bluegene/bgl_job_run.c +++ b/src/plugins/select/bluegene/plugin/bg_job_run.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * bgl_job_run.c - blue gene job execution (e.g. initiation and termination) + * bg_job_run.c - blue gene job execution (e.g. initiation and termination) * functions. * * $Id$ @@ -52,47 +52,47 @@ #include "src/slurmctld/proc_req.h" #include "bluegene.h" -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES #define MAX_POLL_RETRIES 220 #define POLL_INTERVAL 3 #define MAX_AGENT_COUNT 130 enum update_op {START_OP, TERM_OP, SYNC_OP}; -typedef struct bgl_update { +typedef struct bg_update { enum update_op op; /* start | terminate | sync */ uid_t uid; /* new user */ uint32_t job_id; /* SLURM job id */ uint16_t node_use; /* SLURM job node_use */ - pm_partition_id_t bgl_part_id; -} bgl_update_t; + pm_partition_id_t bg_block_id; +} bg_update_t; -static List bgl_update_list = NULL; +static List bg_update_list = NULL; static pthread_mutex_t agent_cnt_mutex = PTHREAD_MUTEX_INITIALIZER; static int agent_cnt = 0; -static void _bgl_list_del(void *x); +static void _bg_list_del(void *x); static int _excise_block(List block_list, - pm_partition_id_t bgl_part_id, + pm_partition_id_t bg_block_id, char *nodes); static List _get_all_blocks(void); -static void * _part_agent(void *args); -static void _part_op(bgl_update_t *bgl_update_ptr); +static void * _block_agent(void *args); +static void _block_op(bg_update_t *bg_update_ptr); static int _remove_job(db_job_id_t job_id); -static void _start_agent(bgl_update_t *bgl_update_ptr); -static void _sync_agent(bgl_update_t *bgl_update_ptr); -static void _term_agent(bgl_update_t *bgl_update_ptr); +static void _start_agent(bg_update_t *bg_update_ptr); +static void _sync_agent(bg_update_t *bg_update_ptr); +static void _term_agent(bg_update_t *bg_update_ptr); -/* Delete a bgl_update_t record */ -static void _bgl_list_del(void *x) +/* Delete a bg_update_t record */ +static void _bg_list_del(void *x) { - bgl_update_t *bgl_update_ptr = (bgl_update_t *) x; + bg_update_t *bg_update_ptr = (bg_update_t *) x; - if (bgl_update_ptr) { - xfree(bgl_update_ptr->bgl_part_id); - xfree(bgl_update_ptr); + if (bg_update_ptr) { + xfree(bg_update_ptr->bg_block_id); + xfree(bg_update_ptr); } } @@ -116,7 +116,7 @@ static int _remove_job(db_job_id_t job_id) } error("rm_get_job(%d): %s", job_id, - bgl_err_str(rc)); + bg_err_str(rc)); continue; } @@ -129,11 +129,11 @@ static int _remove_job(db_job_id_t job_id) } error("rm_get_data(RM_JobState) for jobid=%d " - "%s", job_id, bgl_err_str(rc)); + "%s", job_id, bg_err_str(rc)); continue; } if ((rc = rm_free_job(job_rec)) != STATUS_OK) - error("rm_free_job: %s", bgl_err_str(rc)); + error("rm_free_job: %s", bg_err_str(rc)); debug2("job %d is in state %d", job_id, job_state); @@ -145,7 +145,7 @@ static int _remove_job(db_job_id_t job_id) else if(job_state == RM_JOB_ERROR) { error("job %d is in a error state.", job_id); - //free_bgl_partition(); + //free_bg_block(); return STATUS_OK; } @@ -164,7 +164,7 @@ static int _remove_job(db_job_id_t job_id) job_id); else error("rm_cancel_job(%d): %s", job_id, - bgl_err_str(rc)); + bg_err_str(rc)); } } /* try once more... */ @@ -176,79 +176,80 @@ static int _remove_job(db_job_id_t job_id) -/* Update partition user and reboot as needed */ -static void _sync_agent(bgl_update_t *bgl_update_ptr) +/* Update block user and reboot as needed */ +static void _sync_agent(bg_update_t *bg_update_ptr) { - bgl_record_t * bgl_record = NULL; + bg_record_t * bg_record = NULL; - bgl_record = find_bgl_record(bgl_update_ptr->bgl_part_id); - if(!bgl_record) { - error("No partition %s", bgl_update_ptr->bgl_part_id); + bg_record = find_bg_record(bg_update_ptr->bg_block_id); + if(!bg_record) { + error("No block %s", bg_update_ptr->bg_block_id); return; } - bgl_record->job_running = 1; - if(bgl_record->state==RM_PARTITION_READY) { - if(bgl_record->user_uid != bgl_update_ptr->uid) { - slurm_mutex_lock(&part_state_mutex); + bg_record->job_running = bg_update_ptr->job_id; + + if(bg_record->state==RM_PARTITION_READY) { + if(bg_record->user_uid != bg_update_ptr->uid) { + slurm_mutex_lock(&block_state_mutex); debug("User isn't correct for job %d on %s, " "fixing...", - bgl_update_ptr->job_id, - bgl_update_ptr->bgl_part_id); - xfree(bgl_record->target_name); - bgl_record->target_name = - xstrdup(uid_to_string(bgl_update_ptr->uid)); + bg_update_ptr->job_id, + bg_update_ptr->bg_block_id); + xfree(bg_record->target_name); + bg_record->target_name = + xstrdup(uid_to_string(bg_update_ptr->uid)); - set_part_user(bgl_record); + set_block_user(bg_record); - slurm_mutex_unlock(&part_state_mutex); + slurm_mutex_unlock(&block_state_mutex); } } else { - if(bgl_record->state != RM_PARTITION_CONFIGURING) { - error("Partition %s isn't ready and isn't " + if(bg_record->state != RM_PARTITION_CONFIGURING) { + error("Block %s isn't ready and isn't " "being configured! Starting job again.", - bgl_update_ptr->bgl_part_id); + bg_update_ptr->bg_block_id); } else { - debug("Partition %s is booting, job ok", - bgl_update_ptr->bgl_part_id); + debug("Block %s is booting, job ok", + bg_update_ptr->bg_block_id); } - _start_agent(bgl_update_ptr); + _start_agent(bg_update_ptr); } } /* Perform job initiation work */ -static void _start_agent(bgl_update_t *bgl_update_ptr) +static void _start_agent(bg_update_t *bg_update_ptr) { int rc; - bgl_record_t *bgl_record = NULL; - bgl_record_t *found_record = NULL; + bg_record_t *bg_record = NULL; + bg_record_t *found_record = NULL; ListIterator itr; pthread_attr_t attr_agent; pthread_t thread_agent; int retries; - bgl_record = find_bgl_record(bgl_update_ptr->bgl_part_id); - if(!bgl_record) { - error("partition %s not found in bgl_list", - bgl_update_ptr->bgl_part_id); + bg_record = find_bg_record(bg_update_ptr->bg_block_id); + if(!bg_record) { + error("block %s not found in bg_list", + bg_update_ptr->bg_block_id); return; } - slurm_mutex_lock(&part_state_mutex); - bgl_record->job_running = bgl_update_ptr->job_id; - slurm_mutex_unlock(&part_state_mutex); + slurm_mutex_lock(&block_state_mutex); + bg_record->job_running = bg_update_ptr->job_id; + slurm_mutex_unlock(&block_state_mutex); - if(bgl_record->state == RM_PARTITION_DEALLOCATING) { - debug("Partition is in Deallocating state, waiting for free."); - bgl_free_partition(bgl_record); + if(bg_record->state == RM_PARTITION_DEALLOCATING) { + debug("Block is in Deallocating state, waiting for free."); + bg_free_block(bg_record); } - if(bgl_record->state == RM_PARTITION_FREE) { - num_part_to_free = 0; - num_part_freed = 0; - itr = list_iterator_create(bgl_list); - if(bgl_record->full_partition) { - debug("Using full partition freeing all others"); - while ((found_record = (bgl_record_t*) + if(bg_record->state == RM_PARTITION_FREE) { + num_block_to_free = 0; + num_block_freed = 0; + itr = list_iterator_create(bg_list); + if(bg_record->full_block) { + debug("Using full block freeing all others"); + while ((found_record = (bg_record_t*) list_next(itr)) != NULL) { if(found_record->state != RM_PARTITION_FREE) { slurm_attr_init(&attr_agent); @@ -261,7 +262,7 @@ static void _start_agent(bgl_update_t *bgl_update_ptr) retries = 0; while (pthread_create(&thread_agent, &attr_agent, - mult_free_part, + mult_free_block, (void *) found_record)) { error("pthread_create " @@ -273,20 +274,20 @@ static void _start_agent(bgl_update_t *bgl_update_ptr) /* sleep and retry */ usleep(1000); } - num_part_to_free++; + num_block_to_free++; } } } else { - while ((found_record = (bgl_record_t*) + while ((found_record = (bg_record_t*) list_next(itr)) != NULL) { - if (found_record->full_partition) { + if (found_record->full_block) { if(found_record->state != RM_PARTITION_FREE) { debug("destroying the " - "full partition %s.", + "full block %s.", found_record-> - bgl_part_id); - bgl_free_partition( + bg_block_id); + bg_free_block( found_record); } break; @@ -295,14 +296,14 @@ static void _start_agent(bgl_update_t *bgl_update_ptr) } list_iterator_destroy(itr); - /* wait for all necessary partitions to be freed */ - while(num_part_to_free != num_part_freed) { + /* wait for all necessary blocks to be freed */ + while(num_block_to_free != num_block_freed) { sleep(1); } - if(bgl_record->job_running == -1) + if(bg_record->job_running == 0) return; - if((rc = boot_part(bgl_record)) + if((rc = boot_block(bg_record)) != SLURM_SUCCESS) { sleep(2); /* wait for the slurmd to begin @@ -310,40 +311,40 @@ static void _start_agent(bgl_update_t *bgl_update_ptr) is a no-op if issued prior to the script initiation */ (void) slurm_fail_job( - bgl_update_ptr->job_id); + bg_update_ptr->job_id); return; } - } else if (bgl_record->state == RM_PARTITION_CONFIGURING) { - bgl_record->boot_state = 1; + } else if (bg_record->state == RM_PARTITION_CONFIGURING) { + bg_record->boot_state = 1; } - slurm_mutex_lock(&part_state_mutex); - bgl_record->boot_count = 0; - xfree(bgl_record->target_name); - bgl_record->target_name = xstrdup(uid_to_string(bgl_update_ptr->uid)); - debug("setting the target_name for Partition %s to %s", - bgl_record->bgl_part_id, - bgl_record->target_name); + slurm_mutex_lock(&block_state_mutex); + bg_record->boot_count = 0; + xfree(bg_record->target_name); + bg_record->target_name = xstrdup(uid_to_string(bg_update_ptr->uid)); + debug("setting the target_name for Block %s to %s", + bg_record->bg_block_id, + bg_record->target_name); - if(bgl_record->state == RM_PARTITION_READY) { - debug("partition %s is ready.", - bgl_record->bgl_part_id); + if(bg_record->state == RM_PARTITION_READY) { + debug("block %s is ready.", + bg_record->bg_block_id); - set_part_user(bgl_record); + set_block_user(bg_record); } - slurm_mutex_unlock(&part_state_mutex); + slurm_mutex_unlock(&block_state_mutex); } /* Perform job termination work */ -static void _term_agent(bgl_update_t *bgl_update_ptr) +static void _term_agent(bg_update_t *bg_update_ptr) { int i, jobs, rc; rm_job_list_t *job_list = NULL; int live_states; rm_element_t *job_elem = NULL; - pm_partition_id_t part_id; + pm_partition_id_t block_id; db_job_id_t job_id; - bgl_record_t *bgl_record = NULL; + bg_record_t *bg_record = NULL; time_t now; struct tm *time_ptr; char reason[128]; @@ -354,12 +355,12 @@ static void _term_agent(bgl_update_t *bgl_update_ptr) & (~JOB_TERMINATED_FLAG) & (~JOB_KILLED_FLAG); if ((rc = rm_get_jobs(live_states, &job_list)) != STATUS_OK) { - error("rm_get_jobs(): %s", bgl_err_str(rc)); + error("rm_get_jobs(): %s", bg_err_str(rc)); return; } if ((rc = rm_get_data(job_list, RM_JobListSize, &jobs)) != STATUS_OK) { - error("rm_get_data(RM_JobListSize): %s", bgl_err_str(rc)); + error("rm_get_data(RM_JobListSize): %s", bg_err_str(rc)); jobs = 0; } else if (jobs > 300) fatal("Active job count (%d) invalid, restart MMCS", jobs); @@ -371,14 +372,14 @@ static void _term_agent(bgl_update_t *bgl_update_ptr) if ((rc = rm_get_data(job_list, RM_JobListNextJob, &job_elem)) != STATUS_OK) { error("rm_get_data(RM_JobListNextJob): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } } else { if ((rc = rm_get_data(job_list, RM_JobListFirstJob, &job_elem)) != STATUS_OK) { error("rm_get_data(RM_JobListFirstJob): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } } @@ -388,32 +389,32 @@ static void _term_agent(bgl_update_t *bgl_update_ptr) jobs); break; } - if ((rc = rm_get_data(job_elem, RM_JobPartitionID, &part_id)) + if ((rc = rm_get_data(job_elem, RM_JobPartitionID, &block_id)) != STATUS_OK) { error("rm_get_data(RM_JobPartitionID) %s: %s", - part_id, bgl_err_str(rc)); + block_id, bg_err_str(rc)); continue; } - if(!part_id) { - error("No partitionID returned from Database"); + if(!block_id) { + error("No blockID returned from Database"); continue; } - debug2("looking at partition %s looking for %s\n", - part_id, bgl_update_ptr->bgl_part_id); + debug2("looking at block %s looking for %s\n", + block_id, bg_update_ptr->bg_block_id); - if (strcmp(part_id, bgl_update_ptr->bgl_part_id) != 0) { - free(part_id); + if (strcmp(block_id, bg_update_ptr->bg_block_id) != 0) { + free(block_id); continue; } - free(part_id); + free(block_id); if ((rc = rm_get_data(job_elem, RM_JobDBJobID, &job_id)) != STATUS_OK) { error("rm_get_data(RM_JobDBJobID): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } debug2("got job_id %d",job_id); @@ -423,12 +424,12 @@ static void _term_agent(bgl_update_t *bgl_update_ptr) } } - /* remove the partition's users */ - bgl_record = find_bgl_record(bgl_update_ptr->bgl_part_id); - if(bgl_record) { + /* remove the block's users */ + bg_record = find_bg_record(bg_update_ptr->bg_block_id); + if(bg_record) { debug("got the record %s user is %s", - bgl_record->bgl_part_id, - bgl_record->user_name); + bg_record->bg_block_id, + bg_record->user_name); if(job_remove_failed) { time_ptr = localtime(&now); @@ -437,48 +438,48 @@ static void _term_agent(bgl_update_t *bgl_update_ptr) "Couldn't remove job " "[SLURM@%b %d %H:%M]", time_ptr); - if(bgl_record->nodes) - slurm_drain_nodes(bgl_record->nodes, + if(bg_record->nodes) + slurm_drain_nodes(bg_record->nodes, reason); else - error("Partition %s doesn't have a node list.", - bgl_update_ptr->bgl_part_id); + error("Block %s doesn't have a node list.", + bg_update_ptr->bg_block_id); } - slurm_mutex_lock(&part_state_mutex); - bgl_record->job_running = 0; + slurm_mutex_lock(&block_state_mutex); + bg_record->job_running = 0; /*remove user from list */ - if(bgl_record->target_name) { - if(strcmp(bgl_record->target_name, + if(bg_record->target_name) { + if(strcmp(bg_record->target_name, slurmctld_conf.slurm_user_name)) { - xfree(bgl_record->target_name); - bgl_record->target_name = + xfree(bg_record->target_name); + bg_record->target_name = xstrdup(slurmctld_conf. slurm_user_name); } - update_partition_user(bgl_record); + update_block_user(bg_record); } else { - bgl_record->target_name = + bg_record->target_name = xstrdup(slurmctld_conf.slurm_user_name); } - bgl_record->boot_state = 0; - bgl_record->boot_count = 0; + bg_record->boot_state = 0; + bg_record->boot_count = 0; - last_bgl_update = time(NULL); - slurm_mutex_unlock(&part_state_mutex); + last_bg_update = time(NULL); + slurm_mutex_unlock(&block_state_mutex); } not_removed: if ((rc = rm_free_job_list(job_list)) != STATUS_OK) - error("rm_free_job_list(): %s", bgl_err_str(rc)); + error("rm_free_job_list(): %s", bg_err_str(rc)); } -/* Process requests off the bgl_update_list queue and exit when done */ -static void *_part_agent(void *args) +/* Process requests off the bg_update_list queue and exit when done */ +static void *_block_agent(void *args) { - bgl_update_t *bgl_update_ptr; + bg_update_t *bg_update_ptr; /* * Don't just exit when there is no work left. Creating @@ -488,19 +489,19 @@ static void *_part_agent(void *args) */ while (!agent_fini) { slurm_mutex_lock(&agent_cnt_mutex); - bgl_update_ptr = list_dequeue(bgl_update_list); + bg_update_ptr = list_dequeue(bg_update_list); slurm_mutex_unlock(&agent_cnt_mutex); - if (!bgl_update_ptr) { + if (!bg_update_ptr) { usleep(100000); continue; } - if (bgl_update_ptr->op == START_OP) - _start_agent(bgl_update_ptr); - else if (bgl_update_ptr->op == TERM_OP) - _term_agent(bgl_update_ptr); - else if (bgl_update_ptr->op == SYNC_OP) - _sync_agent(bgl_update_ptr); - _bgl_list_del(bgl_update_ptr); + if (bg_update_ptr->op == START_OP) + _start_agent(bg_update_ptr); + else if (bg_update_ptr->op == TERM_OP) + _term_agent(bg_update_ptr); + else if (bg_update_ptr->op == SYNC_OP) + _sync_agent(bg_update_ptr); + _bg_list_del(bg_update_ptr); } slurm_mutex_lock(&agent_cnt_mutex); agent_cnt--; @@ -508,22 +509,22 @@ static void *_part_agent(void *args) return NULL; } -/* Perform an operation upon a BGL partition (block) for starting or +/* Perform an operation upon a BG block (block) for starting or * terminating a job */ -static void _part_op(bgl_update_t *bgl_update_ptr) +static void _block_op(bg_update_t *bg_update_ptr) { pthread_attr_t attr_agent; pthread_t thread_agent; int retries; slurm_mutex_lock(&agent_cnt_mutex); - if ((bgl_update_list == NULL) - && ((bgl_update_list = list_create(_bgl_list_del)) == NULL)) + if ((bg_update_list == NULL) + && ((bg_update_list = list_create(_bg_list_del)) == NULL)) fatal("malloc failure in start_job/list_create"); /* push job onto queue in a FIFO */ - if (list_push(bgl_update_list, bgl_update_ptr) == NULL) - fatal("malloc failure in _part_op/list_push"); + if (list_push(bg_update_list, bg_update_ptr) == NULL) + fatal("malloc failure in _block_op/list_push"); if (agent_cnt > MAX_AGENT_COUNT) { /* already running an agent */ slurm_mutex_unlock(&agent_cnt_mutex); @@ -537,7 +538,7 @@ static void _part_op(bgl_update_t *bgl_update_ptr) error("pthread_attr_setdetachstate error %m"); retries = 0; - while (pthread_create(&thread_agent, &attr_agent, _part_agent, NULL)) { + while (pthread_create(&thread_agent, &attr_agent, _block_agent, NULL)) { error("pthread_create error %m"); if (++retries > MAX_PTHREAD_RETRIES) fatal("Can't create pthread"); @@ -546,64 +547,64 @@ static void _part_op(bgl_update_t *bgl_update_ptr) } -/* get a list of all BGL blocks with users */ +/* get a list of all BG blocks with users */ static List _get_all_blocks(void) { - List ret_list = list_create(destroy_bgl_record); + List ret_list = list_create(destroy_bg_record); ListIterator itr; - bgl_record_t *block_ptr = NULL; - bgl_record_t *str_ptr = NULL; + bg_record_t *block_ptr = NULL; + bg_record_t *str_ptr = NULL; if (!ret_list) fatal("malloc error"); - if(bgl_list) { - itr = list_iterator_create(bgl_list); - while ((block_ptr = (bgl_record_t *) list_next(itr))) { + if(bg_list) { + itr = list_iterator_create(bg_list); + while ((block_ptr = (bg_record_t *) list_next(itr))) { if ((block_ptr->user_name == NULL) || (block_ptr->user_name[0] == '\0') - || (block_ptr->bgl_part_id == NULL) - || (block_ptr->bgl_part_id[0] == '0')) + || (block_ptr->bg_block_id == NULL) + || (block_ptr->bg_block_id[0] == '0')) continue; - str_ptr = xmalloc(sizeof(bgl_record_t)); - str_ptr->bgl_part_id = xstrdup(block_ptr->bgl_part_id); + str_ptr = xmalloc(sizeof(bg_record_t)); + str_ptr->bg_block_id = xstrdup(block_ptr->bg_block_id); str_ptr->nodes = xstrdup(block_ptr->nodes); list_append(ret_list, str_ptr); } list_iterator_destroy(itr); } else { - error("_get_all_blocks: no bgl_list"); + error("_get_all_blocks: no bg_list"); } return ret_list; } -/* remove a BGL block from the given list */ -static int _excise_block(List block_list, pm_partition_id_t bgl_part_id, +/* remove a BG block from the given list */ +static int _excise_block(List block_list, pm_partition_id_t bg_block_id, char *nodes) { int rc = SLURM_SUCCESS; ListIterator iter; - bgl_record_t *block = NULL; + bg_record_t *block = NULL; if(block_list) { iter = list_iterator_create(block_list); xassert(iter); while ((block = list_next(iter))) { rc = SLURM_ERROR; - if (strcmp(block->bgl_part_id, bgl_part_id)) + if (strcmp(block->bg_block_id, bg_block_id)) continue; if (strcmp(block->nodes, nodes)) { - /* changed bglblock */ - error("bgl_part_id:%s old_nodes:%s " + /* changed bgblock */ + error("bg_block_id:%s old_nodes:%s " "new_nodes:%s", - bgl_part_id, nodes, block->nodes); + bg_block_id, nodes, block->nodes); break; } /* exact match of name and node list */ - debug("synced Partition %s", bgl_part_id); + debug("synced Block %s", bg_block_id); list_delete(iter); rc = SLURM_SUCCESS; break; @@ -617,26 +618,26 @@ static int _excise_block(List block_list, pm_partition_id_t bgl_part_id, } /* - * Perform any work required to terminate a jobs on a partition. - * bgl_part_id IN - partition name + * Perform any work required to terminate a jobs on a block. + * bg_block_id IN - block name * RET - SLURM_SUCCESS or an error code * * NOTE: The job is killed before the function returns. This can take * many seconds. Do not call from slurmctld or any other entity that * can not wait. */ -int term_jobs_on_part(pm_partition_id_t bgl_part_id) +int term_jobs_on_block(pm_partition_id_t bg_block_id) { int rc = SLURM_SUCCESS; - bgl_update_t *bgl_update_ptr; - /* if (bgl_update_list == NULL) { */ + bg_update_t *bg_update_ptr; + /* if (bg_update_list == NULL) { */ /* debug("No jobs started that I know about"); */ /* return rc; */ /* } */ - bgl_update_ptr = xmalloc(sizeof(bgl_update_t)); - bgl_update_ptr->op = TERM_OP; - bgl_update_ptr->bgl_part_id = xstrdup(bgl_part_id); - _part_op(bgl_update_ptr); + bg_update_ptr = xmalloc(sizeof(bg_update_t)); + bg_update_ptr->op = TERM_OP; + bg_update_ptr->bg_block_id = xstrdup(bg_block_id); + _block_op(bg_update_ptr); return rc; } @@ -650,62 +651,62 @@ int term_jobs_on_part(pm_partition_id_t bgl_part_id) * * NOTE: This happens in parallel with srun and slurmd spawning * the job. A prolog script is expected to defer initiation of - * the job script until the BGL block is available for use. + * the job script until the BG block is available for use. */ extern int start_job(struct job_record *job_ptr) { int rc = SLURM_SUCCESS; -#ifdef HAVE_BGL_FILES - bgl_update_t *bgl_update_ptr = NULL; +#ifdef HAVE_BG_FILES + bg_update_t *bg_update_ptr = NULL; - bgl_update_ptr = xmalloc(sizeof(bgl_update_t)); - bgl_update_ptr->op = START_OP; - bgl_update_ptr->uid = job_ptr->user_id; - bgl_update_ptr->job_id = job_ptr->job_id; + bg_update_ptr = xmalloc(sizeof(bg_update_t)); + bg_update_ptr->op = START_OP; + bg_update_ptr->uid = job_ptr->user_id; + bg_update_ptr->job_id = job_ptr->job_id; select_g_get_jobinfo(job_ptr->select_jobinfo, - SELECT_DATA_PART_ID, &(bgl_update_ptr->bgl_part_id)); + SELECT_DATA_BLOCK_ID, &(bg_update_ptr->bg_block_id)); select_g_get_jobinfo(job_ptr->select_jobinfo, - SELECT_DATA_NODE_USE, &(bgl_update_ptr->node_use)); - info("Queue start of job %u in BGL partition %s", + SELECT_DATA_NODE_USE, &(bg_update_ptr->node_use)); + info("Queue start of job %u in BG block %s", job_ptr->job_id, - bgl_update_ptr->bgl_part_id); + bg_update_ptr->bg_block_id); - _part_op(bgl_update_ptr); + _block_op(bg_update_ptr); #else ListIterator itr; - bgl_record_t *bgl_record = NULL; - bgl_record_t *found_record = NULL; - char *part_id = NULL; + bg_record_t *bg_record = NULL; + bg_record_t *found_record = NULL; + char *block_id = NULL; uint16_t node_use; - if (bgl_list) { + if (bg_list) { select_g_get_jobinfo(job_ptr->select_jobinfo, - SELECT_DATA_PART_ID, &part_id); + SELECT_DATA_BLOCK_ID, &block_id); select_g_get_jobinfo(job_ptr->select_jobinfo, SELECT_DATA_NODE_USE, &node_use); - if(!part_id) { - error("NO part_id"); + if(!block_id) { + error("NO block_id"); return rc; } - bgl_record = find_bgl_record(part_id); - itr = list_iterator_create(bgl_list); - while ((found_record = (bgl_record_t *) list_next(itr))) { - if (bgl_record->full_partition) + bg_record = find_bg_record(block_id); + itr = list_iterator_create(bg_list); + while ((found_record = (bg_record_t *) list_next(itr))) { + if (bg_record->full_block) found_record->state = RM_PARTITION_FREE; - else if(found_record->full_partition) + else if(found_record->full_block) found_record->state = RM_PARTITION_FREE; - if ((!found_record->bgl_part_id) - || (strcmp(part_id, found_record->bgl_part_id))) + if ((!found_record->bg_block_id) + || (strcmp(block_id, found_record->bg_block_id))) continue; - found_record->job_running = 1; + found_record->job_running = job_ptr->job_id; found_record->node_use = node_use; found_record->state = RM_PARTITION_READY; - last_bgl_update = time(NULL); + last_bg_update = time(NULL); break; } list_iterator_destroy(itr); - xfree(part_id); + xfree(block_id); } #endif return rc; @@ -724,66 +725,66 @@ extern int start_job(struct job_record *job_ptr) int term_job(struct job_record *job_ptr) { int rc = SLURM_SUCCESS; -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES - bgl_update_t *bgl_update_ptr = NULL; + bg_update_t *bg_update_ptr = NULL; - bgl_update_ptr = xmalloc(sizeof(bgl_update_t)); - bgl_update_ptr->op = TERM_OP; - bgl_update_ptr->uid = job_ptr->user_id; - bgl_update_ptr->job_id = job_ptr->job_id; + bg_update_ptr = xmalloc(sizeof(bg_update_t)); + bg_update_ptr->op = TERM_OP; + bg_update_ptr->uid = job_ptr->user_id; + bg_update_ptr->job_id = job_ptr->job_id; select_g_get_jobinfo(job_ptr->select_jobinfo, - SELECT_DATA_PART_ID, &(bgl_update_ptr->bgl_part_id)); - info("Queue termination of job %u in BGL partition %s", - job_ptr->job_id, bgl_update_ptr->bgl_part_id); - _part_op(bgl_update_ptr); + SELECT_DATA_BLOCK_ID, &(bg_update_ptr->bg_block_id)); + info("Queue termination of job %u in BG block %s", + job_ptr->job_id, bg_update_ptr->bg_block_id); + _block_op(bg_update_ptr); #else - bgl_record_t *bgl_record; - char *part_id = NULL; + bg_record_t *bg_record; + char *block_id = NULL; - if (bgl_list) { + if (bg_list) { select_g_get_jobinfo(job_ptr->select_jobinfo, - SELECT_DATA_PART_ID, &part_id); - if(!part_id) { - error("NO part_id"); + SELECT_DATA_BLOCK_ID, &block_id); + if(!block_id) { + error("NO block_id"); return rc; } - bgl_record = find_bgl_record(part_id); - info("Finished job %u in BGL partition %s", + bg_record = find_bg_record(block_id); + info("Finished job %u in BG block %s", job_ptr->job_id, - bgl_record->bgl_part_id); - bgl_record->state = RM_PARTITION_FREE; - bgl_record->job_running = 0; - last_bgl_update = time(NULL); - xfree(part_id); + bg_record->bg_block_id); + bg_record->state = RM_PARTITION_FREE; + bg_record->job_running = 0; + last_bg_update = time(NULL); + xfree(block_id); } #endif return rc; } /* - * Synchronize BGL block state to that of currently active jobs. - * This can recover from slurmctld crashes when partition usership + * Synchronize BG block state to that of currently active jobs. + * This can recover from slurmctld crashes when block usership * changes were queued */ extern int sync_jobs(List job_list) { -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES ListIterator job_iterator, block_iterator; struct job_record *job_ptr = NULL; - bgl_update_t *bgl_update_ptr = NULL; - bgl_record_t *bgl_record = NULL; + bg_update_t *bg_update_ptr = NULL; + bg_record_t *bg_record = NULL; List block_list; static bool run_already = false; - /* Execute only on initial startup. We don't support bglblock + /* Execute only on initial startup. We don't support bgblock * creation on demand today, so there is no need to re-sync data. */ if (run_already) return SLURM_SUCCESS; run_already = true; - /* Insure that all running jobs own the specified partition */ + /* Insure that all running jobs own the specified block */ block_list = _get_all_blocks(); if(job_list) { job_iterator = list_iterator_create(job_list); @@ -793,13 +794,13 @@ extern int sync_jobs(List job_list) if (job_ptr->job_state != JOB_RUNNING) continue; - bgl_update_ptr = xmalloc(sizeof(bgl_update_t)); + bg_update_ptr = xmalloc(sizeof(bg_update_t)); select_g_get_jobinfo(job_ptr->select_jobinfo, - SELECT_DATA_PART_ID, - &(bgl_update_ptr->bgl_part_id)); + SELECT_DATA_BLOCK_ID, + &(bg_update_ptr->bg_block_id)); - if (bgl_update_ptr->bgl_part_id == NULL) { - error("Running job %u has bglblock==NULL", + if (bg_update_ptr->bg_block_id == NULL) { + error("Running job %u has bgblock==NULL", job_ptr->job_id); good_block = false; } else if (job_ptr->nodes == NULL) { @@ -807,49 +808,49 @@ extern int sync_jobs(List job_list) job_ptr->job_id); good_block = false; } else if (_excise_block(block_list, - bgl_update_ptr->bgl_part_id, + bg_update_ptr->bg_block_id, job_ptr->nodes) != SLURM_SUCCESS) { error("Kill job %u belongs to defunct " - "bglblock %s", + "bgblock %s", job_ptr->job_id, - bgl_update_ptr->bgl_part_id); + bg_update_ptr->bg_block_id); good_block = false; } if (!good_block) { job_ptr->job_state = JOB_FAILED | JOB_COMPLETING; job_ptr->end_time = time(NULL); - xfree(bgl_update_ptr->bgl_part_id); - xfree(bgl_update_ptr); + xfree(bg_update_ptr->bg_block_id); + xfree(bg_update_ptr); continue; } - debug3("Queue sync of job %u in BGL partition %s", + debug3("Queue sync of job %u in BG block %s", job_ptr->job_id, - bgl_update_ptr->bgl_part_id); - bgl_update_ptr->op = SYNC_OP; - bgl_update_ptr->uid = job_ptr->user_id; - bgl_update_ptr->job_id = job_ptr->job_id; - _part_op(bgl_update_ptr); + bg_update_ptr->bg_block_id); + bg_update_ptr->op = SYNC_OP; + bg_update_ptr->uid = job_ptr->user_id; + bg_update_ptr->job_id = job_ptr->job_id; + _block_op(bg_update_ptr); } list_iterator_destroy(job_iterator); } else { error("sync_jobs: no job_list"); return SLURM_ERROR; } - /* Insure that all other partitions are free of users */ + /* Insure that all other blocks are free of users */ if(block_list) { block_iterator = list_iterator_create(block_list); - while ((bgl_record = (bgl_record_t *) + while ((bg_record = (bg_record_t *) list_next(block_iterator))) { - info("Queue clearing of users of BGL partition %s", - bgl_record->bgl_part_id); - bgl_update_ptr = xmalloc(sizeof(bgl_update_t)); - bgl_update_ptr->op = TERM_OP; - bgl_update_ptr->bgl_part_id = - xstrdup(bgl_record->bgl_part_id); - _part_op(bgl_update_ptr); + info("Queue clearing of users of BG block %s", + bg_record->bg_block_id); + bg_update_ptr = xmalloc(sizeof(bg_update_t)); + bg_update_ptr->op = TERM_OP; + bg_update_ptr->bg_block_id = + xstrdup(bg_record->bg_block_id); + _block_op(bg_update_ptr); } list_iterator_destroy(block_iterator); list_destroy(block_list); @@ -862,51 +863,51 @@ extern int sync_jobs(List job_list) } /* - * Boot a partition. Partition state expected to be FREE upon entry. + * Boot a block. Block state expected to be FREE upon entry. * NOTE: This function does not wait for the boot to complete. * the slurm prolog script needs to perform the waiting. */ -extern int boot_part(bgl_record_t *bgl_record) +extern int boot_block(bg_record_t *bg_record) { -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES int rc; - if ((rc = rm_set_part_owner(bgl_record->bgl_part_id, + if ((rc = rm_set_part_owner(bg_record->bg_block_id, slurmctld_conf.slurm_user_name)) != STATUS_OK) { error("rm_set_part_owner(%s,%s): %s", - bgl_record->bgl_part_id, + bg_record->bg_block_id, slurmctld_conf.slurm_user_name, - bgl_err_str(rc)); + bg_err_str(rc)); return SLURM_ERROR; } - info("Booting partition %s", - bgl_record->bgl_part_id); - if ((rc = pm_create_partition(bgl_record->bgl_part_id)) + info("Booting block %s", + bg_record->bg_block_id); + if ((rc = pm_create_partition(bg_record->bg_block_id)) != STATUS_OK) { error("pm_create_partition(%s): %s", - bgl_record->bgl_part_id, bgl_err_str(rc)); + bg_record->bg_block_id, bg_err_str(rc)); return SLURM_ERROR; } rc = 0; while(rc < 10) { - if(bgl_record->state == RM_PARTITION_CONFIGURING) + if(bg_record->state == RM_PARTITION_CONFIGURING) break; sleep(1); rc++; } - slurm_mutex_lock(&part_state_mutex); + slurm_mutex_lock(&block_state_mutex); /* reset state right now, don't wait for * update_partition_list() to run or epilog could * get old/bad data. */ - if(bgl_record->state != RM_PARTITION_CONFIGURING) - bgl_record->state = RM_PARTITION_CONFIGURING; - debug("Setting bootflag for %s", bgl_record->bgl_part_id); - bgl_record->boot_state = 1; - //bgl_record->boot_count = 0; - last_bgl_update = time(NULL); - slurm_mutex_unlock(&part_state_mutex); + if(bg_record->state != RM_PARTITION_CONFIGURING) + bg_record->state = RM_PARTITION_CONFIGURING; + debug("Setting bootflag for %s", bg_record->bg_block_id); + bg_record->boot_state = 1; + //bg_record->boot_count = 0; + last_bg_update = time(NULL); + slurm_mutex_unlock(&block_state_mutex); #endif return SLURM_SUCCESS; } diff --git a/src/plugins/select/bluegene/bgl_job_run.h b/src/plugins/select/bluegene/plugin/bg_job_run.h similarity index 79% rename from src/plugins/select/bluegene/bgl_job_run.h rename to src/plugins/select/bluegene/plugin/bg_job_run.h index b94c76ec77ea6e465c5820a3e4cd77a096d35a3b..b86054983192155261444e7e92b9e4d4f3779372 100644 --- a/src/plugins/select/bluegene/bgl_job_run.h +++ b/src/plugins/select/bluegene/plugin/bg_job_run.h @@ -1,5 +1,5 @@ /*****************************************************************************\ - * bgl_job_run.h - header for blue gene job execution (e.g. initiation and + * bg_job_run.h - header for blue gene job execution (e.g. initiation and * termination) functions. ***************************************************************************** * Copyright (C) 2004 The Regents of the University of California. @@ -24,8 +24,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. \*****************************************************************************/ -#ifndef _BGL_JOB_RUN_H_ -#define _BGL_JOB_RUN_H_ +#ifndef _BG_JOB_RUN_H_ +#define _BG_JOB_RUN_H_ #include "src/slurmctld/slurmctld.h" @@ -36,7 +36,7 @@ * * NOTE: This happens in parallel with srun and slurmd spawning * the job. A prolog script is expected to defer initiation of - * the job script until the BGL block is available for use. + * the job script until the BG block is available for use. */ extern int start_job(struct job_record *job_ptr); @@ -52,26 +52,26 @@ extern int start_job(struct job_record *job_ptr); extern int term_job(struct job_record *job_ptr); /* - * Perform any work required to terminate a jobs on a partition - * bgl_part_id IN - partition name + * Perform any work required to terminate a jobs on a block + * bg_block_id IN - partition name * RET - SLURM_SUCCESS or an error code * * NOTE: This happens when new partitions are created and we * need to clean up jobs on them. */ -extern int term_jobs_on_part(pm_partition_id_t bgl_part_id); +extern int term_jobs_on_block(pm_partition_id_t bg_block_id); /* - * Synchronize BGL block state to that of currently active jobs. - * This can recover from slurmctld crashes when partition ownership + * Synchronize BG block state to that of currently active jobs. + * This can recover from slurmctld crashes when block ownership * changes were queued */ extern int sync_jobs(List job_list); /* - * Boot a partition. Partition state expected to be FREE upon entry. + * Boot a block. Partition state expected to be FREE upon entry. * NOTE: This function does not wait for the boot to complete. * the slurm prolog script needs to perform the waiting. */ -extern int boot_part(bgl_record_t *bgl_record); -#endif /* _BGL_JOB_RUN_H_ */ +extern int boot_block(bg_record_t *bg_record); +#endif /* _BG_JOB_RUN_H_ */ diff --git a/src/plugins/select/bluegene/bgl_switch_connections.c b/src/plugins/select/bluegene/plugin/bg_switch_connections.c similarity index 55% rename from src/plugins/select/bluegene/bgl_switch_connections.c rename to src/plugins/select/bluegene/plugin/bg_switch_connections.c index ae8a89e99b5d8855b7dae06badabe66776ec69d8..fba444709f916ee67bd15c9e814c0cf2de03df65 100644 --- a/src/plugins/select/bluegene/bgl_switch_connections.c +++ b/src/plugins/select/bluegene/plugin/bg_switch_connections.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * bgl_switch_connections.c - Blue Gene switch management functions, + * bg_switch_connections.c - Blue Gene switch management functions, * establish switch connections * * $Id$ @@ -28,54 +28,54 @@ #include "bluegene.h" -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES -List bgl_bp_list; +List bg_bp_list; -static int _get_bp_by_location(rm_BGL_t* my_bgl, +static int _get_bp_by_location(rm_BGL_t* my_bg, int* curr_coord, rm_BP_t** bp); -//static int _set_switch(rm_switch_t* curr_switch, pa_connection_t *int_wire); +//static int _set_switch(rm_switch_t* curr_switch, ba_connection_t *int_wire); static int _add_switch_conns(rm_switch_t* curr_switch, - bgl_switch_t *bgl_switch); -static int _lookat_path(bgl_bp_t *bgl_bp, - pa_switch_t *curr_switch, + bg_switch_t *bg_switch); +static int _lookat_path(bg_bp_t *bg_bp, + ba_switch_t *curr_switch, int source, int target, int dim); -static int _destroy_bgl_bp_list(List bgl_bp); +static int _destroy_bg_bp_list(List bg_bp); /** * this is just stupid. there are some implicit rules for where * "NextBP" goes to, but we don't know, so we have to do this. */ -static int _get_bp_by_location(rm_BGL_t* my_bgl, int* curr_coord, rm_BP_t** bp) +static int _get_bp_by_location(rm_BGL_t* my_bg, int* curr_coord, rm_BP_t** bp) { int i, bp_num, rc; rm_location_t loc; - if ((rc = rm_get_data(my_bgl, RM_BPNum, &bp_num)) != STATUS_OK) { - fatal("rm_get_data: RM_BPNum: %s", bgl_err_str(rc)); + if ((rc = rm_get_data(my_bg, RM_BPNum, &bp_num)) != STATUS_OK) { + fatal("rm_get_data: RM_BPNum: %s", bg_err_str(rc)); return SLURM_ERROR; } for (i=0; i<bp_num; i++){ if(i) { - if ((rc = rm_get_data(my_bgl, RM_NextBP, bp)) + if ((rc = rm_get_data(my_bg, RM_NextBP, bp)) != STATUS_OK) { fatal("rm_get_data: RM_NextBP: %s", - bgl_err_str(rc)); + bg_err_str(rc)); return SLURM_ERROR; } } else { - if ((rc = rm_get_data(my_bgl, RM_FirstBP, bp)) + if ((rc = rm_get_data(my_bg, RM_FirstBP, bp)) != STATUS_OK) { fatal("rm_get_data: RM_FirstBP: %s", - bgl_err_str(rc)); + bg_err_str(rc)); return SLURM_ERROR; } } if ((rc = rm_get_data(*bp, RM_BPLoc, &loc)) != STATUS_OK) { - fatal("rm_get_data: RM_BPLoc: %s", bgl_err_str(rc)); + fatal("rm_get_data: RM_BPLoc: %s", bg_err_str(rc)); return SLURM_ERROR; } @@ -91,10 +91,10 @@ static int _get_bp_by_location(rm_BGL_t* my_bgl, int* curr_coord, rm_BP_t** bp) } static int _add_switch_conns(rm_switch_t* curr_switch, - bgl_switch_t *bgl_switch) + bg_switch_t *bg_switch) { ListIterator itr; - bgl_conn_t *bgl_conn; + bg_conn_t *bg_conn; int firstconnect=1; rm_connection_t conn; @@ -102,18 +102,18 @@ static int _add_switch_conns(rm_switch_t* curr_switch, int conn_num=0; int port = 0; - itr = list_iterator_create(bgl_switch->conn_list); - while((bgl_conn = list_next(itr)) != NULL) { - if(bgl_conn->source == bgl_conn->target) + itr = list_iterator_create(bg_switch->conn_list); + while((bg_conn = list_next(itr)) != NULL) { + if(bg_conn->source == bg_conn->target) continue; for(j=0;j<2;j++) { switch(j) { case 0: - port = bgl_conn->source; + port = bg_conn->source; break; case 1: - port = bgl_conn->target; + port = bg_conn->target; break; } switch(port) { @@ -144,7 +144,7 @@ static int _add_switch_conns(rm_switch_t* curr_switch, RM_SwitchFirstConnection, &conn)) != STATUS_OK) { fatal("rm_set_data(RM_SwitchFirstConnection):" - " %s", bgl_err_str(rc)); + " %s", bg_err_str(rc)); list_iterator_destroy(itr); return SLURM_ERROR; } @@ -154,73 +154,73 @@ static int _add_switch_conns(rm_switch_t* curr_switch, RM_SwitchNextConnection, &conn)) != STATUS_OK) { fatal("rm_set_data(RM_SwitchNextConnection):" - " %s", bgl_err_str(rc)); + " %s", bg_err_str(rc)); list_iterator_destroy(itr); return SLURM_ERROR; } } conn_num++; - debug2("adding %d -> %d",bgl_conn->source, bgl_conn->target); + debug2("adding %d -> %d",bg_conn->source, bg_conn->target); } list_iterator_destroy(itr); if ((rc = rm_set_data(curr_switch, RM_SwitchConnNum, &conn_num)) != STATUS_OK) { - fatal("rm_set_data: RM_SwitchConnNum: %s", bgl_err_str(rc)); + fatal("rm_set_data: RM_SwitchConnNum: %s", bg_err_str(rc)); return SLURM_ERROR; } return SLURM_SUCCESS; } -static int _lookat_path(bgl_bp_t *bgl_bp, pa_switch_t *curr_switch, +static int _lookat_path(bg_bp_t *bg_bp, ba_switch_t *curr_switch, int source, int target, int dim) { - ListIterator bgl_itr, switch_itr, conn_itr; - bgl_switch_t *bgl_switch; - bgl_conn_t *bgl_conn; + ListIterator bg_itr, switch_itr, conn_itr; + bg_switch_t *bg_switch; + bg_conn_t *bg_conn; int *node_tar; int port_tar; int port_tar1; int *node_src; - pa_switch_t *next_switch; + ba_switch_t *next_switch; - switch_itr = list_iterator_create(bgl_bp->switch_list); - while((bgl_switch = list_next(switch_itr)) != NULL) { - if(bgl_switch->dim == dim) + switch_itr = list_iterator_create(bg_bp->switch_list); + while((bg_switch = list_next(switch_itr)) != NULL) { + if(bg_switch->dim == dim) break; } list_iterator_destroy(switch_itr); - if(bgl_switch == NULL) { - bgl_switch = xmalloc(sizeof(bgl_switch_t)); - bgl_switch->dim=dim; - bgl_switch->conn_list = list_create(NULL); - list_append(bgl_bp->switch_list, bgl_switch); + if(bg_switch == NULL) { + bg_switch = xmalloc(sizeof(bg_switch_t)); + bg_switch->dim=dim; + bg_switch->conn_list = list_create(NULL); + list_append(bg_bp->switch_list, bg_switch); } port_tar = curr_switch->int_wire[source].port_tar; - conn_itr = list_iterator_create(bgl_switch->conn_list); - while((bgl_conn = list_next(conn_itr)) != NULL) { + conn_itr = list_iterator_create(bg_switch->conn_list); + while((bg_conn = list_next(conn_itr)) != NULL) { if(port_tar == curr_switch->ext_wire[port_tar].port_tar) { //list_delete(conn_itr); //continue; debug3("I found these %d %d",port_tar, curr_switch->ext_wire[port_tar].port_tar); } - if(((bgl_conn->source == port_tar) - && (bgl_conn->target == source)) - || ((bgl_conn->source == source) - && (bgl_conn->target == port_tar))) + if(((bg_conn->source == port_tar) + && (bg_conn->target == source)) + || ((bg_conn->source == source) + && (bg_conn->target == port_tar))) break; } list_iterator_destroy(conn_itr); - if(bgl_conn == NULL) { - bgl_conn = xmalloc(sizeof(bgl_conn_t)); - bgl_conn->source = source; - bgl_conn->target = port_tar; + if(bg_conn == NULL) { + bg_conn = xmalloc(sizeof(bg_conn_t)); + bg_conn->source = source; + bg_conn->target = port_tar; - list_append(bgl_switch->conn_list, bgl_conn); + list_append(bg_switch->conn_list, bg_conn); } else { return SLURM_SUCCESS; } @@ -249,67 +249,67 @@ static int _lookat_path(bgl_bp_t *bgl_bp, pa_switch_t *curr_switch, port_tar); - bgl_itr = list_iterator_create(bgl_bp_list); - while((bgl_bp = list_next(bgl_itr)) != NULL) { - if((bgl_bp->coord[X] == node_tar[X]) - && (bgl_bp->coord[Y] == node_tar[Y]) - && (bgl_bp->coord[Z] == node_tar[Z])) + bg_itr = list_iterator_create(bg_bp_list); + while((bg_bp = list_next(bg_itr)) != NULL) { + if((bg_bp->coord[X] == node_tar[X]) + && (bg_bp->coord[Y] == node_tar[Y]) + && (bg_bp->coord[Z] == node_tar[Z])) break; } - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); /* It appears this is a past through node */ - if(bgl_bp == NULL) { - bgl_bp = xmalloc(sizeof(bgl_bp_t)); - bgl_bp->coord = node_tar; - bgl_bp->switch_list = list_create(NULL); - list_append(bgl_bp_list, bgl_bp); - bgl_bp->used = 0; + if(bg_bp == NULL) { + bg_bp = xmalloc(sizeof(bg_bp_t)); + bg_bp->coord = node_tar; + bg_bp->switch_list = list_create(NULL); + list_append(bg_bp_list, bg_bp); + bg_bp->used = 0; } - next_switch = &pa_system_ptr-> + next_switch = &ba_system_ptr-> grid[node_tar[X]][node_tar[Y]][node_tar[Z]].axis_switch[dim]; - if(_lookat_path(bgl_bp, next_switch, port_tar, target, dim) + if(_lookat_path(bg_bp, next_switch, port_tar, target, dim) == SLURM_ERROR) return SLURM_ERROR; return SLURM_SUCCESS; } -static int _destroy_bgl_bp_list(List bgl_bp_list) +static int _destroy_bg_bp_list(List bg_bp_list) { - bgl_switch_t *bgl_switch; - bgl_conn_t *bgl_conn; - bgl_bp_t *bgl_bp; + bg_switch_t *bg_switch; + bg_conn_t *bg_conn; + bg_bp_t *bg_bp; - if(bgl_bp_list) { - while((bgl_bp = list_pop(bgl_bp_list)) != NULL) { - while((bgl_switch = list_pop(bgl_bp->switch_list)) + if(bg_bp_list) { + while((bg_bp = list_pop(bg_bp_list)) != NULL) { + while((bg_switch = list_pop(bg_bp->switch_list)) != NULL) { - while((bgl_conn = list_pop( - bgl_switch->conn_list)) + while((bg_conn = list_pop( + bg_switch->conn_list)) != NULL) { - if(bgl_conn) - xfree(bgl_conn); + if(bg_conn) + xfree(bg_conn); } - list_destroy(bgl_switch->conn_list); - if(bgl_switch) - xfree(bgl_switch); + list_destroy(bg_switch->conn_list); + if(bg_switch) + xfree(bg_switch); } - list_destroy(bgl_bp->switch_list); - if(bgl_bp) - xfree(bgl_bp); + list_destroy(bg_bp->switch_list); + if(bg_bp) + xfree(bg_bp); } - list_destroy(bgl_bp_list); + list_destroy(bg_bp_list); } return SLURM_SUCCESS; } -extern int configure_small_partition(bgl_record_t *bgl_record) +extern int configure_small_block(bg_record_t *bg_record) { bool small = true; ListIterator itr; - pa_node_t* pa_node = NULL; + ba_node_t* ba_node = NULL; int rc = SLURM_SUCCESS; rm_BP_t *curr_bp; rm_bp_id_t bp_id = NULL; @@ -319,49 +319,49 @@ extern int configure_small_partition(bgl_record_t *bgl_record) rm_quarter_t quarter; int num, i; - if(bgl_record->bp_count != 1) { - error("Requesting small partition with %d bps, needs to be 1.", - bgl_record->bp_count); + if(bg_record->bp_count != 1) { + error("Requesting small block with %d bps, needs to be 1.", + bg_record->bp_count); return SLURM_ERROR; } - /* set that we are doing a small partition */ - if ((rc = rm_set_data(bgl_record->bgl_part, RM_PartitionSmall, + /* set that we are doing a small block */ + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionSmall, &small)) != STATUS_OK) { - fatal("rm_set_data(RM_PartitionPsetsPerBP)", bgl_err_str(rc)); + fatal("rm_set_data(RM_PartitionPsetsPerBP)", bg_err_str(rc)); } - if ((rc = rm_set_data(bgl_record->bgl_part, + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionNodeCardNum, &num_ncards)) != STATUS_OK) { - fatal("rm_set_data: RM_PartitionBPNum: %s", bgl_err_str(rc)); + fatal("rm_set_data: RM_PartitionBPNum: %s", bg_err_str(rc)); } - itr = list_iterator_create(bgl_record->bgl_part_list); - pa_node = list_next(itr); + itr = list_iterator_create(bg_record->bg_block_list); + ba_node = list_next(itr); list_iterator_destroy(itr); - if (_get_bp_by_location(bgl, pa_node->coord, &curr_bp) + if (_get_bp_by_location(bg, ba_node->coord, &curr_bp) == SLURM_ERROR) { fatal("_get_bp_by_location()"); } /* Set the one BP */ - if ((rc = rm_set_data(bgl_record->bgl_part, + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionBPNum, - &bgl_record->bp_count)) + &bg_record->bp_count)) != STATUS_OK) { - fatal("rm_set_data: RM_PartitionBPNum: %s", bgl_err_str(rc)); + fatal("rm_set_data: RM_PartitionBPNum: %s", bg_err_str(rc)); return SLURM_ERROR; } - if ((rc = rm_set_data(bgl_record->bgl_part, + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionFirstBP, curr_bp)) != STATUS_OK) { fatal("rm_set_data(" "RM_PartitionFirstBP): %s", - bgl_err_str(rc)); + bg_err_str(rc)); return SLURM_ERROR; } @@ -381,7 +381,7 @@ extern int configure_small_partition(bgl_record_t *bgl_record) if((rc = rm_get_data(ncard_list, RM_NodeCardListSize, &num)) != STATUS_OK) { - error("rm_get_data(RM_NodeCardListSize): %s", bgl_err_str(rc)); + error("rm_get_data(RM_NodeCardListSize): %s", bg_err_str(rc)); return SLURM_ERROR; } num_ncards = 0; @@ -413,26 +413,26 @@ extern int configure_small_partition(bgl_record_t *bgl_record) rc = SLURM_ERROR; goto cleanup; } - if(bgl_record->quarter != quarter) + if(bg_record->quarter != quarter) continue; if (num_ncards) { - if ((rc = rm_set_data(bgl_record->bgl_part, + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionNextNodeCard, ncard)) != STATUS_OK) { fatal("rm_set_data(" "RM_PartitionNextNodeCard): %s", - bgl_err_str(rc)); + bg_err_str(rc)); } } else { - if ((rc = rm_set_data(bgl_record->bgl_part, + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionFirstNodeCard, ncard)) != STATUS_OK) { fatal("rm_set_data(" "RM_PartitionFirstNodeCard): %s", - bgl_err_str(rc)); + bg_err_str(rc)); } } num_ncards++; @@ -441,158 +441,158 @@ extern int configure_small_partition(bgl_record_t *bgl_record) } cleanup: if ((rc = rm_free_nodecard_list(ncard_list)) != STATUS_OK) { - error("rm_free_nodecard_list(): %s", bgl_err_str(rc)); + error("rm_free_nodecard_list(): %s", bg_err_str(rc)); return SLURM_ERROR; } - debug("making the small partition"); + debug("making the small block"); return rc; } /** * connect the given switch up with the given connections */ -extern int configure_partition_switches(bgl_record_t * bgl_record) +extern int configure_block_switches(bg_record_t * bg_record) { int i, rc = SLURM_SUCCESS; - ListIterator itr, switch_itr, bgl_itr; - pa_node_t* pa_node; + ListIterator itr, switch_itr, bg_itr; + ba_node_t* ba_node; char *name2; rm_BP_t *curr_bp; - rm_switch_t *coord_switch[PA_SYSTEM_DIMENSIONS]; + rm_switch_t *coord_switch[BA_SYSTEM_DIMENSIONS]; rm_switch_t *curr_switch; - pa_switch_t *pa_switch; + ba_switch_t *ba_switch; char *bpid, *curr_bpid; int found_bpid = 0; int switch_count; - bgl_bp_t *bgl_bp; - bgl_switch_t *bgl_switch; + bg_bp_t *bg_bp; + bg_switch_t *bg_switch; int first_bp=1; int first_switch=1; - bgl_bp_list = list_create(NULL); - bgl_record->switch_count = 0; - bgl_record->bp_count = 0; + bg_bp_list = list_create(NULL); + bg_record->switch_count = 0; + bg_record->bp_count = 0; - itr = list_iterator_create(bgl_record->bgl_part_list); - while ((pa_node = (pa_node_t *) list_next(itr)) != NULL) { + itr = list_iterator_create(bg_record->bg_block_list); + while ((ba_node = (ba_node_t *) list_next(itr)) != NULL) { debug("node %d%d%d", - pa_node->coord[X], - pa_node->coord[Y], - pa_node->coord[Z]); - bgl_itr = list_iterator_create(bgl_bp_list); - while((bgl_bp = list_next(bgl_itr)) != NULL) { - if((bgl_bp->coord[X] == pa_node->coord[X]) - && (bgl_bp->coord[Y] == pa_node->coord[Y]) - && (bgl_bp->coord[Z] == pa_node->coord[Z])) + ba_node->coord[X], + ba_node->coord[Y], + ba_node->coord[Z]); + bg_itr = list_iterator_create(bg_bp_list); + while((bg_bp = list_next(bg_itr)) != NULL) { + if((bg_bp->coord[X] == ba_node->coord[X]) + && (bg_bp->coord[Y] == ba_node->coord[Y]) + && (bg_bp->coord[Z] == ba_node->coord[Z])) break; } - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); - if(bgl_bp == NULL) { - bgl_bp = xmalloc(sizeof(bgl_bp_t)); - bgl_bp->coord = pa_node->coord; - bgl_bp->switch_list = list_create(NULL); - list_append(bgl_bp_list, bgl_bp); + if(bg_bp == NULL) { + bg_bp = xmalloc(sizeof(bg_bp_t)); + bg_bp->coord = ba_node->coord; + bg_bp->switch_list = list_create(NULL); + list_append(bg_bp_list, bg_bp); } - bgl_record->bp_count++; - bgl_bp->used = 1; - for(i=0;i<PA_SYSTEM_DIMENSIONS;i++) { + bg_record->bp_count++; + bg_bp->used = 1; + for(i=0;i<BA_SYSTEM_DIMENSIONS;i++) { - pa_switch = &pa_node->axis_switch[i]; - if(pa_switch->int_wire[0].used) { - _lookat_path(bgl_bp, pa_switch, 0, 1, i); + ba_switch = &ba_node->axis_switch[i]; + if(ba_switch->int_wire[0].used) { + _lookat_path(bg_bp, ba_switch, 0, 1, i); } - /* if(pa_switch->int_wire[1].used) { */ -/* _lookat_path(bgl_bp, pa_switch, 1, 0, i); */ + /* if(ba_switch->int_wire[1].used) { */ +/* _lookat_path(bg_bp, ba_switch, 1, 0, i); */ /* } */ } } list_iterator_destroy(itr); - bgl_itr = list_iterator_create(bgl_bp_list); - while((bgl_bp = list_next(bgl_itr)) != NULL) { + bg_itr = list_iterator_create(bg_bp_list); + while((bg_bp = list_next(bg_itr)) != NULL) { debug3("node %d%d%d", - bgl_bp->coord[X], - bgl_bp->coord[Y], - bgl_bp->coord[Z]); - itr = list_iterator_create(bgl_bp->switch_list); - while((bgl_switch = list_next(itr)) != NULL) { - bgl_record->switch_count++; + bg_bp->coord[X], + bg_bp->coord[Y], + bg_bp->coord[Z]); + itr = list_iterator_create(bg_bp->switch_list); + while((bg_switch = list_next(itr)) != NULL) { + bg_record->switch_count++; } list_iterator_destroy(itr); } - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); - if ((rc = rm_set_data(bgl_record->bgl_part, + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionBPNum, - &bgl_record->bp_count)) + &bg_record->bp_count)) != STATUS_OK) { - fatal("rm_set_data: RM_PartitionBPNum: %s", bgl_err_str(rc)); + fatal("rm_set_data: RM_PartitionBPNum: %s", bg_err_str(rc)); rc = SLURM_ERROR; goto cleanup; } - debug3("BP count %d",bgl_record->bp_count); - if ((rc = rm_set_data(bgl_record->bgl_part, + debug3("BP count %d",bg_record->bp_count); + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionSwitchNum, - &bgl_record->switch_count)) + &bg_record->switch_count)) != STATUS_OK) { fatal("rm_set_data: RM_PartitionSwitchNum: %s", - bgl_err_str(rc)); + bg_err_str(rc)); rc = SLURM_ERROR; goto cleanup; } - debug3("switch count %d",bgl_record->switch_count); + debug3("switch count %d",bg_record->switch_count); first_bp = 1; first_switch = 1; - if ((rc = rm_get_data(bgl, RM_SwitchNum, &switch_count)) + if ((rc = rm_get_data(bg, RM_SwitchNum, &switch_count)) != STATUS_OK) { - fatal("rm_get_data: RM_SwitchNum: %s", bgl_err_str(rc)); + fatal("rm_get_data: RM_SwitchNum: %s", bg_err_str(rc)); rc = SLURM_ERROR; goto cleanup; } - bgl_itr = list_iterator_create(bgl_bp_list); - while((bgl_bp = list_next(bgl_itr)) != NULL) { + bg_itr = list_iterator_create(bg_bp_list); + while((bg_bp = list_next(bg_itr)) != NULL) { - if (_get_bp_by_location(bgl, bgl_bp->coord, &curr_bp) + if (_get_bp_by_location(bg, bg_bp->coord, &curr_bp) == SLURM_ERROR) { - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); rc = SLURM_ERROR; goto cleanup; } - if(bgl_bp->used) { + if(bg_bp->used) { if (first_bp){ - if ((rc = rm_set_data(bgl_record->bgl_part, + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionFirstBP, curr_bp)) != STATUS_OK) { - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); fatal("rm_set_data(" "RM_PartitionFirstBP): %s", - bgl_err_str(rc)); + bg_err_str(rc)); } first_bp = 0; } else { - if ((rc = rm_set_data(bgl_record->bgl_part, + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionNextBP, curr_bp)) != STATUS_OK) { - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); fatal("rm_set_data(RM_PartitionNextBP)" - ": %s", bgl_err_str(rc)); + ": %s", bg_err_str(rc)); } } } if ((rc = rm_get_data(curr_bp, RM_BPID, &bpid)) != STATUS_OK) { - list_iterator_destroy(bgl_itr); - fatal("rm_get_data: RM_BPID: %s", bgl_err_str(rc)); + list_iterator_destroy(bg_itr); + fatal("rm_get_data: RM_BPID: %s", bg_err_str(rc)); } if(!bpid) { @@ -603,28 +603,28 @@ extern int configure_partition_switches(bgl_record_t * bgl_record) found_bpid = 0; for (i=0; i<switch_count; i++) { if(i) { - if ((rc = rm_get_data(bgl, RM_NextSwitch, + if ((rc = rm_get_data(bg, RM_NextSwitch, &curr_switch)) != STATUS_OK) { - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); fatal("rm_get_data: RM_NextSwitch: %s", - bgl_err_str(rc)); + bg_err_str(rc)); } } else { - if ((rc = rm_get_data(bgl, RM_FirstSwitch, + if ((rc = rm_get_data(bg, RM_FirstSwitch, &curr_switch)) != STATUS_OK) { - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); fatal("rm_get_data: " "RM_FirstSwitch: %s", - bgl_err_str(rc)); + bg_err_str(rc)); } } if ((rc = rm_get_data(curr_switch, RM_SwitchBPID, &curr_bpid)) != STATUS_OK) { - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); fatal("rm_get_data: RM_SwitchBPID: %s", - bgl_err_str(rc)); + bg_err_str(rc)); } if(!curr_bpid) { @@ -635,7 +635,7 @@ extern int configure_partition_switches(bgl_record_t * bgl_record) if (!strcasecmp((char *)bpid, (char *)curr_bpid)) { coord_switch[found_bpid] = curr_switch; found_bpid++; - if(found_bpid==PA_SYSTEM_DIMENSIONS) { + if(found_bpid==BA_SYSTEM_DIMENSIONS) { free(curr_bpid); break; } @@ -645,70 +645,59 @@ extern int configure_partition_switches(bgl_record_t * bgl_record) free(bpid); - if(found_bpid==PA_SYSTEM_DIMENSIONS) { + if(found_bpid==BA_SYSTEM_DIMENSIONS) { debug2("adding midplane %d%d%d", - bgl_bp->coord[X], - bgl_bp->coord[Y], - bgl_bp->coord[Z]); - switch_itr = list_iterator_create(bgl_bp->switch_list); - while((bgl_switch = list_next(switch_itr)) != NULL) { + bg_bp->coord[X], + bg_bp->coord[Y], + bg_bp->coord[Z]); + switch_itr = list_iterator_create(bg_bp->switch_list); + while((bg_switch = list_next(switch_itr)) != NULL) { - /* if ((rc = rm_get_data(coord_switch */ -/* [bgl_switch->dim], */ -/* RM_SwitchID,&name2)) */ -/* != STATUS_OK) { */ -/* fatal("rm_get_data: RM_SwitchID: %s",*/ -/* bgl_err_str(rc)); */ -/* list_iterator_destroy(bgl_itr); */ -/* list_iterator_destroy(switch_itr); */ -/* rc = SLURM_ERROR; */ -/* goto cleanup; */ -/* } */ debug2("adding switch dim %d", - bgl_switch->dim); + bg_switch->dim); if (_add_switch_conns(coord_switch - [bgl_switch->dim], - bgl_switch) + [bg_switch->dim], + bg_switch) == SLURM_ERROR) { list_iterator_destroy(switch_itr); - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); rc = SLURM_ERROR; goto cleanup; } if (first_switch){ if ((rc = rm_set_data( - bgl_record->bgl_part, + bg_record->bg_block, RM_PartitionFirstSwitch, coord_switch - [bgl_switch->dim])) + [bg_switch->dim])) != STATUS_OK) { list_iterator_destroy( switch_itr); - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); fatal("rm_set_data(" "RM_PartitionFirst" "Switch): %s", - bgl_err_str(rc)); + bg_err_str(rc)); } first_switch = 0; } else { if ((rc = rm_set_data( - bgl_record->bgl_part, + bg_record->bg_block, RM_PartitionNextSwitch, coord_switch - [bgl_switch->dim])) + [bg_switch->dim])) != STATUS_OK) { list_iterator_destroy( switch_itr); - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); fatal("rm_set_data(" "RM_PartitionNext" "Switch:) %s", - bgl_err_str(rc)); + bg_err_str(rc)); } } } @@ -717,7 +706,7 @@ extern int configure_partition_switches(bgl_record_t * bgl_record) } rc = SLURM_SUCCESS; cleanup: - if (_destroy_bgl_bp_list(bgl_bp_list) == SLURM_ERROR) + if (_destroy_bg_bp_list(bg_bp_list) == SLURM_ERROR) return SLURM_ERROR; return rc; diff --git a/src/plugins/select/bluegene/plugin/block_sys.c b/src/plugins/select/bluegene/plugin/block_sys.c new file mode 100755 index 0000000000000000000000000000000000000000..1d9e4988800483ef0ba67eb6739e3250d1127215 --- /dev/null +++ b/src/plugins/select/bluegene/plugin/block_sys.c @@ -0,0 +1,548 @@ +/*****************************************************************************\ + * partition_sys.c - component used for wiring up the partitions + * + * $Id$ + ***************************************************************************** + * Copyright (C) 2004 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Dan Phung <phung4@llnl.gov> and Danny Auble <da@llnl.gov> + * + * This file is part of SLURM, a resource management program. + * For details, see <http://www.llnl.gov/linux/slurm/>. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +\*****************************************************************************/ + +#include "bluegene.h" + + +/** these are used in the dynamic partitioning algorithm */ + +/* global system = list of free partitions */ +List bg_sys_free = NULL; +/* global system = list of allocated partitions */ +List bg_sys_allocated = NULL; + +/* static void _init_sys(partition_t*); */ + + /** + * _get_bp: get the BP at location loc + * + * IN - bg: pointer to preinitialized bg pointer + * IN - bp: pointer to preinitailized rm_element_t that will + * hold the BP that we resolve to. + * IN - loc: location of the desired BP + * OUT - bp: will point to BP at location loc + * OUT - rc: error code (0 = success) + */ +#ifdef HAVE_BG_FILES +static void _pre_allocate(bg_record_t *bg_record); +static int _post_allocate(bg_record_t *bg_record); +static int _post_bg_init_read(void *object, void *arg); +static int _split_block(bg_record_t *bg_record); + +#define MAX_ADD_RETRY 2 + +#if 0 +/* Vestigial + * print out a list + */ +static void _print_list(List list) +{ + int* stuff = NULL, i = 0; + ListIterator itr; + + if (list == NULL) + return; + + debug("trying to get the list iterator"); + itr = list_iterator_create(list); + debug("done"); + + debug("printing list"); + while ((stuff = (int*) list_next(itr))) { + debug("stuff %d", stuff); + if (stuff == NULL){ + break; + } + + debug("[ %d", stuff[0]); + for (i=1; i<PA_SYSTEM_DIMENSIONS; i++){ + debug(" x %d", stuff[i]); + } + debug(" ]"); + } + list_iterator_destroy(itr); +} +#endif + +/** + * initialize the BG partition in the resource manager + */ +static void _pre_allocate(bg_record_t *bg_record) +{ + int rc; + int send_psets=numpsets; + + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionBlrtsImg, + bluegene_blrts)) != STATUS_OK) + error("rm_set_data(RM_PartitionBlrtsImg)", bg_err_str(rc)); + + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionLinuxImg, + bluegene_linux)) != STATUS_OK) + error("rm_set_data(RM_PartitionLinuxImg)", bg_err_str(rc)); + + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionMloaderImg, + bluegene_mloader)) != STATUS_OK) + error("rm_set_data(RM_PartitionMloaderImg)", bg_err_str(rc)); + + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionRamdiskImg, + bluegene_ramdisk)) != STATUS_OK) + error("rm_set_data(RM_PartitionRamdiskImg)", bg_err_str(rc)); + + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionConnection, + &bg_record->conn_type)) != STATUS_OK) + error("rm_set_data(RM_PartitionConnection)", bg_err_str(rc)); + + if(bg_record->cnodes_per_bp == (procs_per_node/4)) + send_psets = numpsets/4; + + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionPsetsPerBP, + &send_psets)) != STATUS_OK) + error("rm_set_data(RM_PartitionPsetsPerBP)", bg_err_str(rc)); + + if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionUserName, + slurmctld_conf.slurm_user_name)) != STATUS_OK) + error("rm_set_data(RM_PartitionUserName)", bg_err_str(rc)); +/* info("setting it here"); */ +/* bg_record->bg_block_id = "RMP101"; */ +/* if ((rc = rm_set_data(bg_record->bg_block, RM_PartitionID, */ +/* &bg_record->bg_block_id)) != STATUS_OK) */ +/* error("rm_set_data(RM_PartitionID)", bg_err_str(rc)); */ +} + +/** + * add the partition record to the DB + */ +static int _post_allocate(bg_record_t *bg_record) +{ + int rc, i; + pm_partition_id_t block_id; + struct passwd *pw_ent = NULL; + /* Add partition record to the DB */ + debug("adding partition\n"); + + for(i=0;i<MAX_ADD_RETRY; i++) { + if ((rc = rm_add_partition(bg_record->bg_block)) + != STATUS_OK) { + error("rm_add_partition(): %s", bg_err_str(rc)); + rc = SLURM_ERROR; + } else { + rc = SLURM_SUCCESS; + break; + } + sleep(3); + } + if(rc == SLURM_ERROR) { + if ((rc = rm_free_partition(bg_record->bg_block)) + != STATUS_OK) + error("rm_free_partition(): %s", bg_err_str(rc)); + fatal("couldn't add last partition."); + } + debug("done adding\n"); + + /* Get back the new partition id */ + if ((rc = rm_get_data(bg_record->bg_block, RM_PartitionID, &block_id)) + != STATUS_OK) { + error("rm_get_data(RM_PartitionID): %s", bg_err_str(rc)); + bg_record->bg_block_id = xstrdup("UNKNOWN"); + } else { + if(!block_id) { + error("No Partition ID was returned from database"); + return SLURM_ERROR; + } + bg_record->bg_block_id = xstrdup(block_id); + + free(block_id); + + xfree(bg_record->target_name); + bg_record->target_name = + xstrdup(slurmctld_conf.slurm_user_name); + + xfree(bg_record->user_name); + bg_record->user_name = + xstrdup(slurmctld_conf.slurm_user_name); + + if((pw_ent = getpwnam(bg_record->user_name)) == NULL) { + error("getpwnam(%s): %m", bg_record->user_name); + } else { + bg_record->user_uid = pw_ent->pw_uid; + } + last_bg_update = time(NULL); + + } + /* We are done with the partition */ + if ((rc = rm_free_partition(bg_record->bg_block)) != STATUS_OK) + error("rm_free_partition(): %s", bg_err_str(rc)); + return rc; +} + +static int _post_bg_init_read(void *object, void *arg) +{ + bg_record_t *bg_record = (bg_record_t *) object; + int i = 1024; + bg_record->nodes = xmalloc(i); + while (hostlist_ranged_string(bg_record->hostlist, i, + bg_record->nodes) < 0) { + i *= 2; + xrealloc(bg_record->nodes, i); + } + + if (node_name2bitmap(bg_record->nodes, + false, + &bg_record->bitmap)) { + error("Unable to convert nodes %s to bitmap", + bg_record->nodes); + } + //print_bg_record(bg_record); + + return SLURM_SUCCESS; +} + +extern int configure_block(bg_record_t *bg_record) +{ + /* new partition to be added */ + rm_new_partition(&bg_record->bg_block); + _pre_allocate(bg_record); + if(bg_record->cnodes_per_bp < procs_per_node) + configure_small_block(bg_record); + else + configure_block_switches(bg_record); + + _post_allocate(bg_record); + return 1; +} + +/* + * Download from MMCS the initial BG block information + */ +int read_bg_blocks() +{ + int rc = SLURM_SUCCESS; + + int bp_cnt, i; + rm_element_t *bp_ptr = NULL; + rm_bp_id_t bpid; + rm_partition_t *block_ptr = NULL; + char node_name_tmp[255], *user_name = NULL; + bg_record_t *bg_record = NULL; + struct passwd *pw_ent = NULL; + + int *coord; + int block_number, block_count; + char *block_name = NULL; + rm_partition_list_t *block_list = NULL; + rm_partition_state_flag_t state = PARTITION_ALL_FLAG; + rm_nodecard_t *ncard = NULL; + bool small = false; + + if ((rc = rm_set_serial(BG_SERIAL)) != STATUS_OK) { + error("rm_set_serial(): %s\n", bg_err_str(rc)); + return SLURM_ERROR; + } + set_bp_map(); + if ((rc = rm_get_partitions_info(state, &block_list)) + != STATUS_OK) { + error("rm_get_partitions_info(): %s", bg_err_str(rc)); + return SLURM_ERROR; + + } + + if ((rc = rm_get_data(block_list, RM_PartListSize, &block_count)) + != STATUS_OK) { + error("rm_get_data(RM_PartListSize): %s", bg_err_str(rc)); + block_count = 0; + } + + for(block_number=0; block_number<block_count; block_number++) { + + if (block_number) { + if ((rc = rm_get_data(block_list, RM_PartListNextPart, + &block_ptr)) != STATUS_OK) { + error("rm_get_data(RM_PartListNextPart): %s", + bg_err_str(rc)); + break; + } + } else { + if ((rc = rm_get_data(block_list, RM_PartListFirstPart, + &block_ptr)) != STATUS_OK) { + error("rm_get_data(RM_PartListFirstPart): %s", + bg_err_str(rc)); + break; + } + } + + if ((rc = rm_get_data(block_ptr, RM_PartitionID, &block_name)) + != STATUS_OK) { + error("rm_get_data(RM_PartitionID): %s", + bg_err_str(rc)); + continue; + } + + if(!block_name) { + error("No Partition ID was returned from database"); + continue; + } + + if(strncmp("RMP", block_name, 3)) { + free(block_name); + continue; + } + if(bg_recover) + if ((rc = rm_get_partition(block_name, &block_ptr)) + != STATUS_OK) { + error("Partition %s doesn't exist.", + block_name); + rc = SLURM_ERROR; + free(block_name); + break; + } + /* New BG partition record */ + + bg_record = xmalloc(sizeof(bg_record_t)); + list_push(bg_curr_block_list, bg_record); + + bg_record->bg_block_id = xstrdup(block_name); + + free(block_name); + + bg_record->state = -1; + bg_record->quarter = -1; + + if ((rc = rm_get_data(block_ptr, + RM_PartitionBPNum, + &bp_cnt)) + != STATUS_OK) { + error("rm_get_data(RM_BPNum): %s", + bg_err_str(rc)); + bp_cnt = 0; + } + + if(bp_cnt==0) + goto clean_up; + + if ((rc = rm_get_data(block_ptr, RM_PartitionSmall, &small)) + != STATUS_OK) { + error("rm_get_data(RM_BPNum): %s", bg_err_str(rc)); + bp_cnt = 0; + } + if(small) { + if((rc = rm_get_data(block_ptr, + RM_PartitionFirstNodeCard, + &ncard)) + != STATUS_OK) { + error("rm_get_data(RM_FirstCard): %s", + bg_err_str(rc)); + bp_cnt = 0; + } + if ((rc = rm_get_data(ncard, + RM_NodeCardQuarter, + &bg_record->quarter)) != STATUS_OK) { + error("rm_get_data(CardQuarter): %d",rc); + bp_cnt = 0; + } + debug("%s is in quarter %d", + bg_record->bg_block_id, + bg_record->quarter); + } + + bg_record->bg_block_list = list_create(NULL); + bg_record->hostlist = hostlist_create(NULL); + + /* this needs to be changed for small partitions, + we just don't know what they are suppose to look + like just yet. + */ + + for (i=0; i<bp_cnt; i++) { + if(i) { + if ((rc = rm_get_data(block_ptr, + RM_PartitionNextBP, + &bp_ptr)) + != STATUS_OK) { + error("rm_get_data(RM_NextBP): %s", + bg_err_str(rc)); + rc = SLURM_ERROR; + break; + } + } else { + if ((rc = rm_get_data(block_ptr, + RM_PartitionFirstBP, + &bp_ptr)) + != STATUS_OK) { + error("rm_get_data(RM_FirstBP): %s", + bg_err_str(rc)); + rc = SLURM_ERROR; + if (bg_recover) + rm_free_partition(block_ptr); + return rc; + } + } + if ((rc = rm_get_data(bp_ptr, RM_BPID, &bpid)) + != STATUS_OK) { + error("rm_get_data(RM_BPLoc): %s", + bg_err_str(rc)); + rc = SLURM_ERROR; + break; + } + + if(!bpid) { + error("No BP ID was returned from database"); + continue; + } + + coord = find_bp_loc(bpid); + + free(bpid); + + if(!coord) + fatal("No contact with db2. Shutting down."); + + sprintf(node_name_tmp, + "%s%d%d%d\0", + slurmctld_conf.node_prefix, + coord[X], coord[Y], coord[Z]); + + hostlist_push(bg_record->hostlist, node_name_tmp); + } + + // need to get the 000x000 range for nodes + // also need to get coords + if(small) + bg_record->conn_type = SELECT_SMALL; + else + if ((rc = rm_get_data(block_ptr, + RM_PartitionConnection, + &bg_record->conn_type)) + != STATUS_OK) { + error("rm_get_data" + "(RM_PartitionConnection): %s", + bg_err_str(rc)); + } + if ((rc = rm_get_data(block_ptr, RM_PartitionMode, + &bg_record->node_use)) + != STATUS_OK) { + error("rm_get_data(RM_PartitionMode): %s", + bg_err_str(rc)); + } + + if ((rc = rm_get_data(block_ptr, RM_PartitionState, + &bg_record->state)) != STATUS_OK) { + error("rm_get_data(RM_PartitionState): %s", + bg_err_str(rc)); + } else if(bg_record->state == RM_PARTITION_CONFIGURING) + bg_record->boot_state = 1; + else + bg_record->boot_state = 0; + + debug("Partition %s is in state %d", + bg_record->bg_block_id, + bg_record->state); + + if ((rc = rm_get_data(block_ptr, RM_PartitionUsersNum, + &bp_cnt)) != STATUS_OK) { + error("rm_get_data(RM_PartitionUsersNum): %s", + bg_err_str(rc)); + } else { + if(bp_cnt==0) { + bg_record->user_name = + xstrdup(slurmctld_conf. + slurm_user_name); + bg_record->target_name = + xstrdup(slurmctld_conf. + slurm_user_name); + } else { + user_name = NULL; + if ((rc = rm_get_data(block_ptr, + RM_PartitionFirstUser, + &user_name)) + != STATUS_OK) { + error("rm_get_data" + "(RM_PartitionFirstUser): %s", + bg_err_str(rc)); + } + if(!user_name) { + error("No user name was " + "returned from database"); + goto clean_up; + } + bg_record->user_name = xstrdup(user_name); + + if(!bg_record->boot_state) + bg_record->target_name = + xstrdup(slurmctld_conf. + slurm_user_name); + else + bg_record->target_name = + xstrdup(user_name); + + free(user_name); + + } + if((pw_ent = getpwnam(bg_record->user_name)) + == NULL) { + error("getpwnam(%s): %m", + bg_record->user_name); + } else { + bg_record->user_uid = pw_ent->pw_uid; + } + } + + if ((rc = rm_get_data(block_ptr, RM_PartitionBPNum, + &bg_record->bp_count)) != STATUS_OK) { + error("rm_get_data(RM_PartitionBPNum): %s", + bg_err_str(rc)); + } + debug("has %d BPs", + bg_record->bp_count); + + if ((rc = rm_get_data(block_ptr, RM_PartitionSwitchNum, + &bg_record->switch_count)) != STATUS_OK) { + error("rm_get_data(RM_PartitionSwitchNum): %s", + bg_err_str(rc)); + } + + if(small) + bg_record->cnodes_per_bp = procs_per_node/4; + else + bg_record->cnodes_per_bp = procs_per_node; + + bg_record->block_lifecycle = STATIC; + +clean_up: if (bg_recover + && ((rc = rm_free_partition(block_ptr)) != STATUS_OK)) { + error("rm_free_partition(): %s", bg_err_str(rc)); + } + } + rm_free_partition_list(block_list); + + /* perform post-processing for each bluegene partition */ + if(bg_recover) + list_for_each(bg_curr_block_list, _post_bg_init_read, NULL); + return rc; +} + +#endif + diff --git a/src/plugins/select/bluegene/plugin/bluegene.c b/src/plugins/select/bluegene/plugin/bluegene.c new file mode 100644 index 0000000000000000000000000000000000000000..27be07683432057ae09fb7de8a341131ac9cbc48 --- /dev/null +++ b/src/plugins/select/bluegene/plugin/bluegene.c @@ -0,0 +1,1838 @@ +/*****************************************************************************\ + * bluegene.c - blue gene node configuration processing module. + * + * $Id$ + ***************************************************************************** + * Copyright (C) 2004 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Danny Auble <auble1@llnl.gov> et. al. + * + * This file is part of SLURM, a resource management program. + * For details, see <http://www.llnl.gov/linux/slurm/>. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +\*****************************************************************************/ + +#include "bluegene.h" +#include <stdio.h> + +#define BUFSIZE 4096 +#define BITSIZE 128 +#define MMCS_POLL_TIME 120 /* poll MMCS for down switches and nodes + * every 120 secs */ +#define BG_POLL_TIME 0 /* poll bg blocks every 3 secs */ + +#define _DEBUG 0 + +char* bg_conf = NULL; + +/* Global variables */ +rm_BGL_t *bg; +List bg_list = NULL; /* list of bg_record entries */ +List bg_curr_block_list = NULL; /* current bg blocks */ +List bg_found_block_list = NULL; /* found bg blocks */ +char *bluegene_blrts = NULL, *bluegene_linux = NULL, *bluegene_mloader = NULL; +char *bluegene_ramdisk = NULL, *bridge_api_file = NULL; +char *change_numpsets = NULL; +int numpsets; +bool agent_fini = false; +int bridge_api_verb = 0; +time_t last_bg_update; +pthread_mutex_t block_state_mutex = PTHREAD_MUTEX_INITIALIZER; +int num_block_to_free = 0; +int num_block_freed = 0; +int blocks_are_created = 0; +bg_record_t *full_system_block = NULL; + +#ifdef HAVE_BG_FILES + static pthread_mutex_t freed_cnt_mutex = PTHREAD_MUTEX_INITIALIZER; + static int _update_bg_record_state(List bg_destroy_list); +#else +# if BA_SYSTEM_DIMENSIONS==3 + int max_dim[BA_SYSTEM_DIMENSIONS] = { 0, 0, 0 }; +# else + int max_dim[BA_SYSTEM_DIMENSIONS] = { 0 }; +# endif +#endif + +/* some local functions */ +#ifdef HAVE_BG +static int _addto_node_list(bg_record_t *bg_record, int *start, int *end); +#endif +#ifdef HAVE_BG_FILES +#endif +static void _set_bg_lists(); +static int _validate_config_nodes(void); +static int _bg_record_cmpf_inc(bg_record_t* rec_a, bg_record_t* rec_b); +static int _delete_old_blocks(void); +static char *_get_bg_conf(void); +static void _strip_13_10(char *line); +static int _parse_bg_spec(char *in_line); +static void _process_nodes(bg_record_t *bg_record); +static int _reopen_bridge_log(void); + +/* Initialize all plugin variables */ +extern int init_bg(void) +{ +#ifdef HAVE_BG_FILES + int rc; + rm_size3D_t bp_size; + + info("Attempting to contact MMCS"); + if ((rc = rm_set_serial(BG_SERIAL)) != STATUS_OK) { + fatal("init_bg: rm_set_serial(): %s", bg_err_str(rc)); + return SLURM_ERROR; + } + + if ((rc = rm_get_BGL(&bg)) != STATUS_OK) { + fatal("init_bg: rm_get_BGL(): %s", bg_err_str(rc)); + return SLURM_ERROR; + } + + if ((rc = rm_get_data(bg, RM_Msize, &bp_size)) != STATUS_OK) { + fatal("init_bg: rm_get_data(): %s", bg_err_str(rc)); + return SLURM_ERROR; + } + verbose("BlueGene configured with %d x %d x %d base blocks", + bp_size.X, bp_size.Y, bp_size.Z); + DIM_SIZE[X]=bp_size.X; + DIM_SIZE[Y]=bp_size.Y; + DIM_SIZE[Z]=bp_size.Z; +#endif + ba_init(NULL); + + info("BlueGene plugin loaded successfully"); + + return SLURM_SUCCESS; +} + +/* Purge all plugin variables */ +extern void fini_bg(void) +{ + int rc; + + _set_bg_lists(); + + if (bg_list) { + list_destroy(bg_list); + bg_list = NULL; + } + + if (bg_curr_block_list) { + list_destroy(bg_curr_block_list); + bg_curr_block_list = NULL; + } + + if (bg_found_block_list) { + list_destroy(bg_found_block_list); + bg_found_block_list = NULL; + } + + xfree(bluegene_blrts); + xfree(bluegene_linux); + xfree(bluegene_mloader); + xfree(bluegene_ramdisk); + xfree(bridge_api_file); + +#ifdef HAVE_BG_FILES + if(bg) + if ((rc = rm_free_BGL(bg)) != STATUS_OK) + error("rm_free_BGL(): %s", bg_err_str(rc)); +#endif + ba_fini(); +} + +extern void print_bg_record(bg_record_t* bg_record) +{ + if (!bg_record) { + error("print_bg_record, record given is null"); + return; + } +#if _DEBUG + info(" bg_record: "); + if (bg_record->bg_block_id) + info("\tbg_block_id: %s", bg_record->bg_block_id); + info("\tnodes: %s", bg_record->nodes); + info("\tsize: %d", bg_record->bp_count); + info("\tgeo: %dx%dx%d", bg_record->geo[X], bg_record->geo[Y], + bg_record->geo[Z]); + info("\tlifecycle: %s", convert_lifecycle(bg_record->block_lifecycle)); + info("\tconn_type: %s", convert_conn_type(bg_record->conn_type)); + info("\tnode_use: %s", convert_node_use(bg_record->node_use)); + if (bg_record->hostlist) { + char buffer[BUFSIZE]; + hostlist_ranged_string(bg_record->hostlist, BUFSIZE, buffer); + info("\thostlist %s", buffer); + } + if (bg_record->bitmap) { + char bitstring[BITSIZE]; + bit_fmt(bitstring, BITSIZE, bg_record->bitmap); + info("\tbitmap: %s", bitstring); + } +#else + info("bg_block_id=%s nodes=%s", bg_record->bg_block_id, + bg_record->nodes); +#endif +} + +extern void destroy_bg_record(void* object) +{ + bg_record_t* bg_record = (bg_record_t*) object; + + if (bg_record) { + xfree(bg_record->nodes); + xfree(bg_record->user_name); + xfree(bg_record->target_name); + if(bg_record->bg_block_list) + list_destroy(bg_record->bg_block_list); + if(bg_record->hostlist) + hostlist_destroy(bg_record->hostlist); + if(bg_record->bitmap) + bit_free(bg_record->bitmap); + xfree(bg_record->bg_block_id); + + xfree(bg_record); + } +} + + +extern bg_record_t *find_bg_record(char *bg_block_id) +{ + ListIterator itr; + bg_record_t *bg_record = NULL; + + if(!bg_block_id) + return NULL; + + if(bg_list) { + itr = list_iterator_create(bg_list); + while ((bg_record = + (bg_record_t *) list_next(itr)) != NULL) { + if(bg_record->bg_block_id) + if (!strcmp(bg_record->bg_block_id, + bg_block_id)) + break; + } + list_iterator_destroy(itr); + if(bg_record) + return bg_record; + else + return NULL; + } else { + error("find_bg_record: no bg_list"); + return NULL; + } + +} +/* All changes to the bg_list target_name must + be done before this function is called. +*/ +extern int update_block_user(bg_record_t *bg_record) +{ +#ifdef HAVE_BG_FILES + int rc=0; + struct passwd *pw_ent = NULL; + + if(!bg_record->target_name) { + error("Must set target_name to run update_block_user."); + return -1; + } + + if((rc = remove_all_users(bg_record->bg_block_id, + bg_record->target_name)) + == REMOVE_USER_ERR) { + error("Something happened removing " + "users from block %s", + bg_record->bg_block_id); + return -1; + } else if (rc == REMOVE_USER_NONE) { + if (strcmp(bg_record->target_name, + slurmctld_conf.slurm_user_name)) { + info("Adding user %s to Block %s", + bg_record->target_name, + bg_record->bg_block_id); + + if ((rc = rm_add_part_user(bg_record->bg_block_id, + bg_record->target_name)) + != STATUS_OK) { + error("rm_add_part_user(%s,%s): %s", + bg_record->bg_block_id, + bg_record->target_name, + bg_err_str(rc)); + return -1; + } + } + } + + if(strcmp(bg_record->target_name, bg_record->user_name)) { + xfree(bg_record->user_name); + bg_record->user_name = xstrdup(bg_record->target_name); + if((pw_ent = getpwnam(bg_record->user_name)) == NULL) { + error("getpwnam(%s): %m", bg_record->user_name); + return -1; + } else { + bg_record->user_uid = pw_ent->pw_uid; + } + return 1; + } + +#endif + return 0; +} + +extern int remove_all_users(char *bg_block_id, char *user_name) +{ + int returnc = REMOVE_USER_NONE; +#ifdef HAVE_BG_FILES + char *user; + rm_partition_t *block_ptr = NULL; + int rc, i, user_count; + + if ((rc = rm_get_partition(bg_block_id, &block_ptr)) != STATUS_OK) { + error("rm_get_partition(%s): %s", + bg_block_id, + bg_err_str(rc)); + return REMOVE_USER_ERR; + } + + if((rc = rm_get_data(block_ptr, RM_PartitionUsersNum, &user_count)) + != STATUS_OK) { + error("rm_get_data(RM_PartitionUsersNum): %s", + bg_err_str(rc)); + returnc = REMOVE_USER_ERR; + user_count = 0; + } else + debug2("got %d users for %s",user_count, bg_block_id); + for(i=0; i<user_count; i++) { + if(i) { + if ((rc = rm_get_data(block_ptr, + RM_PartitionNextUser, + &user)) + != STATUS_OK) { + error("rm_get_partition(%s): %s", + bg_block_id, + bg_err_str(rc)); + returnc = REMOVE_USER_ERR; + break; + } + } else { + if ((rc = rm_get_data(block_ptr, + RM_PartitionFirstUser, + &user)) + != STATUS_OK) { + error("rm_get_data(%s): %s", + bg_block_id, + bg_err_str(rc)); + returnc = REMOVE_USER_ERR; + break; + } + } + if(!user) { + error("No user was returned from database"); + continue; + } + if(!strcmp(user, slurmctld_conf.slurm_user_name)) { + free(user); + continue; + } + + if(user_name) { + if(!strcmp(user, user_name)) { + returnc = REMOVE_USER_FOUND; + free(user); + continue; + } + } + + info("Removing user %s from Block %s", + user, + bg_block_id); + if ((rc = rm_remove_part_user(bg_block_id, user)) + != STATUS_OK) { + debug("user %s isn't on block %s", + user, + bg_block_id); + } + free(user); + } + if ((rc = rm_free_partition(block_ptr)) != STATUS_OK) { + error("rm_free_partition(): %s", bg_err_str(rc)); + } +#endif + return returnc; +} + +extern void set_block_user(bg_record_t *bg_record) +{ + int rc = 0; + debug("resetting the boot state flag and " + "counter for block %s.", + bg_record->bg_block_id); + bg_record->boot_state = 0; + bg_record->boot_count = 0; + if((rc = update_block_user(bg_record)) == 1) { + last_bg_update = time(NULL); + } else if (rc == -1) { + error("Unable to add user name to block %s. " + "Cancelling job.", + bg_record->bg_block_id); + (void) slurm_fail_job( + bg_record->job_running); + } + xfree(bg_record->target_name); + bg_record->target_name = + xstrdup(slurmctld_conf.slurm_user_name); +} + +extern char* convert_lifecycle(lifecycle_type_t lifecycle) +{ + if (lifecycle == DYNAMIC) + return "DYNAMIC"; + else + return "STATIC"; +} + +extern char* convert_conn_type(rm_connection_type_t conn_type) +{ + switch (conn_type) { + case (SELECT_MESH): + return "MESH"; + case (SELECT_TORUS): + return "TORUS"; + case (SELECT_SMALL): + return "SMALL"; + case (SELECT_NAV): + return "NAV"; + default: + break; + } + return ""; +} + +extern char* convert_node_use(rm_partition_mode_t pt) +{ + switch (pt) { + case (SELECT_COPROCESSOR_MODE): + return "COPROCESSOR"; + case (SELECT_VIRTUAL_NODE_MODE): + return "VIRTUAL"; + default: + break; + } + return ""; +} + +/** + * sort the partitions by increasing size + */ +extern void sort_bg_record_inc_size(List records){ + if (records == NULL) + return; + list_sort(records, (ListCmpF) _bg_record_cmpf_inc); +} + +/* + * bluegene_agent - detached thread periodically updates status of + * bluegene nodes. + * + * NOTE: I don't grab any locks here because slurm_drain_nodes grabs + * the necessary locks. + */ +extern void *bluegene_agent(void *args) +{ + static time_t last_mmcs_test; + static time_t last_bg_test; + int rc; + + last_mmcs_test = time(NULL) + MMCS_POLL_TIME; + last_bg_test = time(NULL) + BG_POLL_TIME; + while (!agent_fini) { + time_t now = time(NULL); + + if (difftime(now, last_bg_test) >= BG_POLL_TIME) { + if (agent_fini) /* don't bother */ + return NULL; /* quit now */ + if(last_bg_update) { + last_bg_test = now; + if((rc = update_block_list()) == 1) + last_bg_update = now; + else if(rc == -1) + error("Error " + "with update_block_list"); + } + } + + if (difftime(now, last_mmcs_test) >= MMCS_POLL_TIME) { + if (agent_fini) /* don't bother */ + return NULL; /* quit now */ + last_mmcs_test = now; + test_mmcs_failures(); /* can run for a while */ + } + + sleep(1); + } + return NULL; +} + +/* + * Convert a BG API error code to a string + * IN inx - error code from any of the BG Bridge APIs + * RET - string describing the error condition + */ +extern char *bg_err_str(status_t inx) +{ +#ifdef HAVE_BG_FILES + switch (inx) { + case STATUS_OK: + return "Status OK"; + case PARTITION_NOT_FOUND: + return "Partition not found"; + case JOB_NOT_FOUND: + return "Job not found"; + case BP_NOT_FOUND: + return "Base partition not found"; + case SWITCH_NOT_FOUND: + return "Switch not found"; + case JOB_ALREADY_DEFINED: + return "Job already defined"; + case CONNECTION_ERROR: + return "Connection error"; + case INTERNAL_ERROR: + return "Internal error"; + case INVALID_INPUT: + return "Invalid input"; + case INCOMPATIBLE_STATE: + return "Incompatible state"; + case INCONSISTENT_DATA: + return "Inconsistent data"; + } +#endif + + return "?"; +} + +/* + * create_static_blocks - create the static blocks that will be used + * for scheduling. + * IN/OUT block_list - (global, from slurmctld): SLURM's block + * configurations. Fill in bg_block_id + * RET - success of fitting all configurations + */ +extern int create_static_blocks(List block_list) +{ + int rc = SLURM_SUCCESS; + + ListIterator itr; + struct passwd *pw_ent = NULL; + bg_record_t *bg_record = NULL, *found_record = NULL; + char *name = NULL; +#ifndef HAVE_BG_FILES + static int block_inx = 0; +#else + ListIterator itr_found; + init_wires(); +#endif + slurm_mutex_lock(&block_state_mutex); + reset_ba_system(); + + if(bg_list) { + itr = list_iterator_create(bg_list); + while ((bg_record = (bg_record_t *) list_next(itr)) + != NULL) { + if(bg_record->bp_count>0 + && !bg_record->full_block + && bg_record->cnodes_per_bp == procs_per_node) { + debug("adding %s %d%d%d", + bg_record->nodes, + bg_record->start[X], + bg_record->start[Y], + bg_record->start[Z]); + name = set_bg_block(NULL, + bg_record->start, + bg_record->geo, + bg_record->conn_type); + if(!name) { + error("I was unable to make the " + "requested block."); + slurm_mutex_unlock(&block_state_mutex); + return SLURM_ERROR; + } + xfree(name); + } + } + list_iterator_destroy(itr); + } else { + error("create_static_blocks: no bg_list 1"); + slurm_mutex_unlock(&block_state_mutex); + return SLURM_ERROR; + } + +#ifdef HAVE_BG_FILES + if(bg_list) { + itr = list_iterator_create(bg_list); + while ((bg_record = (bg_record_t *) list_next(itr)) + != NULL) { + if(bg_found_block_list) { + itr_found = list_iterator_create( + bg_found_block_list); + while ((found_record = (bg_record_t*) + list_next(itr_found)) != NULL) { + /*printf("%s %d %s %d\n",*/ +/* bg_record->nodes, */ +/* bg_record->quarter, */ +/* found_record->nodes, */ +/* found_record->quarter); */ + + if ((!strcmp(bg_record->nodes, + found_record->nodes)) + && (bg_record->quarter == + found_record->quarter)) { + /* don't reboot this one */ + break; + } + } + list_iterator_destroy(itr_found); + } else { + error("create_static_blocks: " + "no bg_found_block_list 1"); + } + if(found_record == NULL) { + if((rc = configure_block(bg_record)) + == SLURM_ERROR) { + list_iterator_destroy(itr); + slurm_mutex_unlock(&block_state_mutex); + return rc; + } + print_bg_record(bg_record); + } + } + list_iterator_destroy(itr); + } else { + error("create_static_blocks: no bg_list 2"); + slurm_mutex_unlock(&block_state_mutex); + return SLURM_ERROR; + } +#endif + + /* Here we are adding a block that in for the entire machine + just in case it isn't in the bluegene.conf file. + */ + + reset_ba_system(); + + bg_record = (bg_record_t*) xmalloc(sizeof(bg_record_t)); + + +#ifdef HAVE_BG_FILES + bg_record->geo[X] = DIM_SIZE[X] - 1; + bg_record->geo[Y] = DIM_SIZE[Y] - 1; + bg_record->geo[Z] = DIM_SIZE[Z] - 1; +#else + bg_record->geo[X] = max_dim[X]; + bg_record->geo[Y] = max_dim[Y]; + bg_record->geo[Z] = max_dim[Z]; +#endif + name = xmalloc(sizeof(char)*(10+strlen(slurmctld_conf.node_prefix))); + if((bg_record->geo[X] == 0) && (bg_record->geo[Y] == 0) + && (bg_record->geo[Z] == 0)) + sprintf(name, "%s000\0", slurmctld_conf.node_prefix); + else + sprintf(name, "%s[000x%d%d%d]\0", + slurmctld_conf.node_prefix, + bg_record->geo[X], bg_record->geo[Y], + bg_record->geo[Z]); + bg_record->nodes = xstrdup(name); + xfree(name); + bg_record->quarter = -1; + bg_record->full_block = 1; + if(bg_found_block_list) { + itr = list_iterator_create(bg_found_block_list); + while ((found_record = (bg_record_t *) list_next(itr)) + != NULL) { + if (!strcmp(bg_record->nodes, found_record->nodes)) { + destroy_bg_record(bg_record); + list_iterator_destroy(itr); + /* don't create total already there */ + goto no_total; + } + } + list_iterator_destroy(itr); + } else { + error("create_static_blocks: no bg_found_block_list 2"); + } + + if(bg_list) { + itr = list_iterator_create(bg_list); + while ((found_record = (bg_record_t *) list_next(itr)) + != NULL) { + if (!strcmp(bg_record->nodes, found_record->nodes)) { + destroy_bg_record(bg_record); + list_iterator_destroy(itr); + /* don't create total already defined */ + goto no_total; + } + } + list_iterator_destroy(itr); + } else { + error("create_static_blocks: no bg_list 3"); + slurm_mutex_unlock(&block_state_mutex); + return SLURM_ERROR; + } + full_system_block = bg_record; + bg_record->bg_block_list = list_create(NULL); + bg_record->hostlist = hostlist_create(NULL); + /* bg_record->boot_state = 0; Implicit */ + _process_nodes(bg_record); + list_append(bg_list, bg_record); + + bg_record->conn_type = SELECT_TORUS; + bg_record->user_name = xstrdup(slurmctld_conf.slurm_user_name); + bg_record->target_name = xstrdup(slurmctld_conf.slurm_user_name); + if((pw_ent = getpwnam(bg_record->user_name)) == NULL) { + error("getpwnam(%s): %m", bg_record->user_name); + slurm_mutex_unlock(&block_state_mutex); + return SLURM_ERROR; + } else { + bg_record->user_uid = pw_ent->pw_uid; + } + + name = set_bg_block(NULL, + bg_record->start, + bg_record->geo, + bg_record->conn_type); + + if(!name) { + error("I was unable to make the " + "requested block."); + slurm_mutex_unlock(&block_state_mutex); + return SLURM_ERROR; + } + xfree(name); + bg_record->node_use = SELECT_COPROCESSOR_MODE; + bg_record->cnodes_per_bp = procs_per_node; +#ifdef HAVE_BG_FILES + if((rc = configure_block(bg_record)) == SLURM_ERROR) { + slurm_mutex_unlock(&block_state_mutex); + return rc; + } + print_bg_record(bg_record); + +#else + if(bg_list) { + itr = list_iterator_create(bg_list); + while ((bg_record = (bg_record_t*) list_next(itr))) { + if (bg_record->bg_block_id) + continue; + bg_record->bg_block_id = xmalloc(8); + snprintf(bg_record->bg_block_id, 8, "RMP%d", + block_inx++); + info("BG BlockID:%s Nodes:%s Conn:%s Mode:%s", + bg_record->bg_block_id, bg_record->nodes, + convert_conn_type(bg_record->conn_type), + convert_node_use(bg_record->node_use)); + } + list_iterator_destroy(itr); + } else { + error("create_static_blocks: no bg_list 4"); + slurm_mutex_unlock(&block_state_mutex); + return SLURM_ERROR; + } +#endif /* HAVE_BG_FILES */ + +no_total: + if(bg_list) { + itr = list_iterator_create(bg_list); + while ((bg_record = (bg_record_t*) list_next(itr)) != NULL) { +#ifdef HAVE_BG_FILES + if ((bg_record->geo[X] == DIM_SIZE[X]) + && (bg_record->geo[Y] == DIM_SIZE[Y]) + && (bg_record->geo[Z] == DIM_SIZE[Z])) { +#else + if ((bg_record->geo[X] == max_dim[X]+1) + && (bg_record->geo[Y] == max_dim[Y]+1) + && (bg_record->geo[Z] == max_dim[Z]+1)) { +#endif + debug("full partiton = %s.", + bg_record->bg_block_id); + bg_record->full_block = 1; + full_system_block = bg_record; + break; + } + } + list_iterator_destroy(itr); + } else { + error("create_static_blocks: no bg_list 5"); + } + last_bg_update = time(NULL); + slurm_mutex_unlock(&block_state_mutex); +#ifdef _PRINT_BLOCKS_AND_EXIT + if(bg_list) { + itr = list_iterator_create(bg_list); + debug("\n\n"); + while ((found_record = (bg_record_t *) list_next(itr)) + != NULL) { + print_bg_record(found_record); + } + list_iterator_destroy(itr); + } else { + error("create_static_blocks: no bg_list 5"); + } + exit(0); +#endif /* _PRINT_BLOCKS_AND_EXIT */ + rc = SLURM_SUCCESS; + //exit(0); + return rc; +} + +extern int bg_free_block(bg_record_t *bg_record) +{ +#ifdef HAVE_BG_FILES + int rc; + if(!bg_record) { + error("bg_free_block: there was no bg_record"); + return SLURM_ERROR; + } + while (1) { + if (bg_record->state != -1 + && bg_record->state != RM_PARTITION_FREE + && bg_record->state != RM_PARTITION_DEALLOCATING) { + debug("pm_destroy %s",bg_record->bg_block_id); + if ((rc = pm_destroy_partition( + bg_record->bg_block_id)) + != STATUS_OK) { + if(rc == PARTITION_NOT_FOUND) { + debug("block %s is not found"); + break; + } + error("pm_destroy_partition(%s): %s " + "State = %d", + bg_record->bg_block_id, + bg_err_str(rc), bg_record->state); + } + } + + if ((bg_record->state == RM_PARTITION_FREE) + || (bg_record->state == RM_PARTITION_ERROR)) + break; + sleep(3); + } +#endif + return SLURM_SUCCESS; +} + +/* Free multiple blocks in parallel */ +extern void *mult_free_block(void *args) +{ +#ifdef HAVE_BG_FILES + bg_record_t *bg_record = (bg_record_t*) args; + + debug("freeing the block %s.", bg_record->bg_block_id); + bg_free_block(bg_record); + debug("done\n"); + slurm_mutex_lock(&freed_cnt_mutex); + num_block_freed++; + slurm_mutex_unlock(&freed_cnt_mutex); +#endif + return NULL; +} + +/* destroy multiple blocks in parallel */ +extern void *mult_destroy_block(void *args) +{ +#ifdef HAVE_BG_FILES + bg_record_t *bg_record = (bg_record_t*) args; + int rc; + + debug("removing the jobs on block %s\n", + bg_record->bg_block_id); + term_jobs_on_block(bg_record->bg_block_id); + + debug("destroying %s\n", + (char *)bg_record->bg_block_id); + bg_free_block(bg_record); + + rc = rm_remove_partition( + bg_record->bg_block_id); + if (rc != STATUS_OK) { + error("rm_remove_partition(%s): %s", + bg_record->bg_block_id, + bg_err_str(rc)); + } else + debug("done\n"); + slurm_mutex_lock(&freed_cnt_mutex); + num_block_freed++; + slurm_mutex_unlock(&freed_cnt_mutex); + +#endif + return NULL; +} + +/* + * Read and process the bluegene.conf configuration file so to interpret what + * blocks are static/dynamic, torus/mesh, etc. + */ +extern int read_bg_conf(void) +{ + FILE *bg_spec_file; /* pointer to input data file */ + int line_num; /* line number in input file */ + char in_line[BUFSIZE]; /* input line */ + int i, j, error_code = SLURM_SUCCESS; + static time_t last_config_update = (time_t) 0; + struct stat config_stat; + + debug("Reading the bluegene.conf file"); + + /* check if config file has changed */ + if (!bg_conf) + bg_conf = _get_bg_conf(); + if (stat(bg_conf, &config_stat) < 0) + fatal("can't stat bluegene.conf file %s: %m", bg_conf); + if (last_config_update) { + if(last_config_update == config_stat.st_mtime) + debug("bluegene.conf unchanged"); + else + debug("bluegene.conf changed, doing nothing"); + _reopen_bridge_log(); + last_config_update = config_stat.st_mtime; + return SLURM_SUCCESS; + } + last_config_update = config_stat.st_mtime; + + /* initialization */ + /* bg_conf defined in bg_node_alloc.h */ + bg_spec_file = fopen(bg_conf, "r"); + if (bg_spec_file == NULL) + fatal("_read_bg_conf error opening file %s, %m", + bg_conf); + + _set_bg_lists(); + + /* process the data file */ + line_num = 0; + while (fgets(in_line, BUFSIZE, bg_spec_file) != NULL) { + line_num++; + _strip_13_10(in_line); + if (strlen(in_line) >= (BUFSIZE - 1)) { + error("_read_bg_config line %d, of input file %s " + "too long", line_num, bg_conf); + fclose(bg_spec_file); + xfree(bg_conf); + return E2BIG; + } + + /* everything after a non-escaped "#" is a comment */ + /* replace comment flag "#" with an end of string (NULL) */ + /* escape sequence "\#" translated to "#" */ + for (i = 0; i < BUFSIZE; i++) { + if (in_line[i] == (char) NULL) + break; + if (in_line[i] != '#') + continue; + if ((i > 0) && (in_line[i - 1] == '\\')) { + for (j = i; j < BUFSIZE; j++) { + in_line[j - 1] = in_line[j]; + } + continue; + } + in_line[i] = (char) NULL; + break; + } + + /* parse what is left, non-comments */ + /* block configuration parameters */ + error_code = _parse_bg_spec(in_line); + + /* report any leftover strings on input line */ + report_leftover(in_line, line_num); + } + fclose(bg_spec_file); + xfree(bg_conf); + + if (!bluegene_blrts) + fatal("BlrtsImage not configured in bluegene.conf"); + if (!bluegene_linux) + fatal("LinuxImage not configured in bluegene.conf"); + if (!bluegene_mloader) + fatal("MloaderImage not configured in bluegene.conf"); + if (!bluegene_ramdisk) + fatal("RamDiskImage not configured in bluegene.conf"); + if (!bridge_api_file) + info("BridgeAPILogFile not configured in bluegene.conf"); + else + _reopen_bridge_log(); + if (!numpsets) + info("Warning: Numpsets not configured in bluegene.conf"); +//#if 0 + /* Check to see if the configs we have are correct */ + if (_validate_config_nodes() == SLURM_ERROR) { + _delete_old_blocks(); + } +//#endif + /* looking for blocks only I created */ + if (create_static_blocks(NULL) == SLURM_ERROR) { + /* error in creating the static blocks, so + * blocks referenced by submitted jobs won't + * correspond to actual slurm blocks. + */ + fatal("Error, could not create the static blocks"); + return SLURM_ERROR; + } + debug("Blocks have finished being created."); + blocks_are_created = 1; + + return error_code; +} + +#ifdef HAVE_BG_FILES +static int _update_bg_record_state(List bg_destroy_list) +{ + rm_partition_state_flag_t block_state = PARTITION_ALL_FLAG; + char *name = NULL; + rm_partition_list_t *block_list = NULL; + int j, rc, func_rc = SLURM_SUCCESS, num_blocks = 0; + rm_partition_state_t state; + rm_partition_t *block_ptr = NULL; + ListIterator itr; + bg_record_t* bg_record = NULL; + + if(!bg_destroy_list) { + return SLURM_SUCCESS; + } + + if ((rc = rm_get_partitions_info(block_state, &block_list)) + != STATUS_OK) { + error("rm_get_partitions_info(): %s", bg_err_str(rc)); + return SLURM_ERROR; + } + + if ((rc = rm_get_data(block_list, RM_PartListSize, &num_blocks)) + != STATUS_OK) { + error("rm_get_data(RM_PartListSize): %s", bg_err_str(rc)); + func_rc = SLURM_ERROR; + num_blocks = 0; + } + + for (j=0; j<num_blocks; j++) { + if (j) { + if ((rc = rm_get_data(block_list, + RM_PartListNextPart, + &block_ptr)) + != STATUS_OK) { + error("rm_get_data(RM_PartListNextPart): %s", + bg_err_str(rc)); + func_rc = SLURM_ERROR; + break; + } + } else { + if ((rc = rm_get_data(block_list, + RM_PartListFirstPart, + &block_ptr)) + != STATUS_OK) { + error("rm_get_data(RM_PartListFirstPart: %s", + bg_err_str(rc)); + func_rc = SLURM_ERROR; + break; + } + } + if ((rc = rm_get_data(block_ptr, + RM_PartitionID, + &name)) + != STATUS_OK) { + error("rm_get_data(RM_PartitionID): %s", + bg_err_str(rc)); + func_rc = SLURM_ERROR; + break; + } + if (!name) { + error("RM_Partition is NULL"); + continue; + } + + itr = list_iterator_create(bg_destroy_list); + while ((bg_record = (bg_record_t*) list_next(itr))) { + if(!bg_record->bg_block_id) + continue; + if(strcmp(bg_record->bg_block_id, name)) { + continue; + } + + slurm_mutex_lock(&block_state_mutex); + if ((rc = rm_get_data(block_ptr, + RM_PartitionState, + &state)) + != STATUS_OK) { + error("rm_get_data(RM_PartitionState): %s", + bg_err_str(rc)); + } else if(bg_record->state != state) { + debug("state of Block %s was %d " + "and now is %d", + name, bg_record->state, state); + bg_record->state = state; + } + slurm_mutex_unlock(&block_state_mutex); + break; + } + list_iterator_destroy(itr); + free(name); + } + + if ((rc = rm_free_partition_list(block_list)) != STATUS_OK) { + error("rm_free_partition_list(): %s", bg_err_str(rc)); + } + return func_rc; +} +#endif /* HAVE_BG_FILES */ + +#ifdef HAVE_BG +static int _addto_node_list(bg_record_t *bg_record, int *start, int *end) +{ + int node_count=0; + int x,y,z; + char node_name_tmp[255]; + debug3("%d%d%dx%d%d%d", + start[X], + start[Y], + start[Z], + end[X], + end[Y], + end[Z]); + debug3("%d%d%d", + DIM_SIZE[X], + DIM_SIZE[Y], + DIM_SIZE[Z]); + + assert(end[X] < DIM_SIZE[X]); + assert(start[X] >= 0); + assert(end[Y] < DIM_SIZE[Y]); + assert(start[Y] >= 0); + assert(end[Z] < DIM_SIZE[Z]); + assert(start[Z] >= 0); + + for (x = start[X]; x <= end[X]; x++) { + for (y = start[Y]; y <= end[Y]; y++) { + for (z = start[Z]; z <= end[Z]; z++) { + sprintf(node_name_tmp, "%s%d%d%d\0", + slurmctld_conf.node_prefix, + x, y, z); + list_append(bg_record->bg_block_list, + &ba_system_ptr->grid[x][y][z]); + node_count++; + } + } + } + return node_count; +} +#endif //HAVE_BG + +static void _set_bg_lists() +{ + bg_record_t *bg_record = NULL; + + slurm_mutex_lock(&block_state_mutex); + if (bg_found_block_list) { + while ((bg_record = list_pop(bg_found_block_list)) != NULL) { + } + } else + bg_found_block_list = list_create(NULL); + + if (bg_curr_block_list){ + while ((bg_record = list_pop(bg_curr_block_list)) != NULL){ + destroy_bg_record(bg_record); + } + } else + bg_curr_block_list = list_create(destroy_bg_record); + +/* empty the old list before reading new data */ + if (bg_list) { + while ((bg_record = list_pop(bg_list)) != NULL) { + destroy_bg_record(bg_record); + } + } else + bg_list = list_create(destroy_bg_record); + slurm_mutex_unlock(&block_state_mutex); + +} + +/* + * Match slurm configuration information with current BG block + * configuration. Return SLURM_SUCCESS if they match, else an error + * code. Writes bg_block_id into bg_list records. + */ + +static int _validate_config_nodes(void) +{ + int rc = SLURM_ERROR; +#ifdef HAVE_BG_FILES + bg_record_t* record = NULL; + bg_record_t* init_record = NULL; + ListIterator itr_conf; + ListIterator itr_curr; + rm_partition_mode_t node_use; + + /* read current bg block info into bg_curr_block_list */ + if (read_bg_blocks() == SLURM_ERROR) + return SLURM_ERROR; + + if(!bg_recover) + return SLURM_ERROR; + + if(bg_list) { + itr_conf = list_iterator_create(bg_list); + while ((record = (bg_record_t*) list_next(itr_conf))) { + /* translate hostlist to ranged + string for consistent format + search here + */ + node_use = SELECT_COPROCESSOR_MODE; + + if(bg_curr_block_list) { + itr_curr = list_iterator_create( + bg_curr_block_list); + while ((init_record = (bg_record_t*) + list_next(itr_curr)) + != NULL) { + if (strcasecmp(record->nodes, + init_record->nodes)) + continue; /* wrong nodes */ + if (record->conn_type + != init_record->conn_type) + continue; /* wrong conn_type */ + if(record->quarter != + init_record->quarter) + continue; /* wrong quart */ + record->bg_block_id = xstrdup( + init_record->bg_block_id); + record->state = init_record->state; + record->node_use = + init_record->node_use; + record->user_uid = + init_record->user_uid; + record->user_name = xstrdup( + init_record->user_name); + record->target_name = xstrdup( + init_record->target_name); + record->boot_state = + init_record->boot_state; + break; + } + list_iterator_destroy(itr_curr); + } else { + error("_validate_config_nodes: " + "no bg_curr_block_list"); + } + if (!record->bg_block_id) { + info("Block found in bluegene.conf to be " + "created: Nodes:%s", + record->nodes); + rc = SLURM_ERROR; + } else { + list_append(bg_found_block_list, record); + info("Found existing BG BlockID:%s " + "Nodes:%s Conn:%s Mode:%s", + record->bg_block_id, + record->nodes, + convert_conn_type(record->conn_type), + convert_node_use(record->node_use)); + } + } + list_iterator_destroy(itr_conf); + if(bg_curr_block_list) { + itr_curr = list_iterator_create( + bg_curr_block_list); + while ((init_record = (bg_record_t*) + list_next(itr_curr)) + != NULL) { + _process_nodes(init_record); + debug3("%s %d %d%d%d %d%d%d", + init_record->bg_block_id, + init_record->bp_count, + init_record->geo[X], + init_record->geo[Y], + init_record->geo[Z], + DIM_SIZE[X], + DIM_SIZE[Y], + DIM_SIZE[Z]); + if ((init_record->geo[X] == DIM_SIZE[X]) + && (init_record->geo[Y] == DIM_SIZE[Y]) + && (init_record->geo[Z] == DIM_SIZE[Z])) { + record = (bg_record_t*) + xmalloc(sizeof(bg_record_t)); + list_append(bg_list, record); + debug("full system %s", + init_record->bg_block_id); + full_system_block = init_record; + record->full_block = 1; + record->bg_block_id = xstrdup( + init_record->bg_block_id); + record->nodes = xstrdup( + init_record->nodes); + record->state = init_record->state; + record->node_use = + init_record->node_use; + record->user_uid = + init_record->user_uid; + record->user_name = xstrdup( + init_record->user_name); + record->target_name = xstrdup( + init_record->target_name); + record->conn_type = + init_record->conn_type; + record->node_use = + init_record->node_use; + record->bp_count = + init_record->bp_count; + record->boot_state = + init_record->boot_state; + record->switch_count = + init_record->switch_count; + record->cnodes_per_bp = + init_record->cnodes_per_bp; + record->quarter = + init_record->quarter; + if((record->bitmap = + bit_copy(init_record->bitmap)) + == NULL) { + error("Unable to copy " + "bitmap for", + init_record->nodes); + } + list_append(bg_found_block_list, + record); + info("Found existing BG " + "BlockID:%s " + "Nodes:%s Conn:%s Mode:%s", + record->bg_block_id, + record->nodes, + convert_conn_type( + record->conn_type), + convert_node_use( + record->node_use)); + break; + } + } + list_iterator_destroy(itr_curr); + } else { + error("_validate_config_nodes: " + "no bg_curr_block_list 2"); + } + + if(list_count(bg_list) == list_count(bg_curr_block_list)) + rc = SLURM_SUCCESS; + } else { + error("_validate_config_nodes: no bg_list"); + rc = SLURM_ERROR; + } +#endif + + return rc; +} + +/* + * Comparator used for sorting blocks smallest to largest + * + * returns: -1: rec_a >rec_b 0: rec_a == rec_b 1: rec_a < rec_b + * + */ +static int _bg_record_cmpf_inc(bg_record_t* rec_a, bg_record_t* rec_b) +{ + int size_a = rec_a->bp_count * rec_a->cnodes_per_bp; + int size_b = rec_b->bp_count * rec_b->cnodes_per_bp; + if (size_a < size_b) + return -1; + else if (size_a > size_b) + return 1; + else + return 0; +} + +static int _delete_old_blocks(void) +{ +#ifdef HAVE_BG_FILES + ListIterator itr_curr, itr_found; + bg_record_t *found_record = NULL, *init_record = NULL; + pthread_attr_t attr_agent; + pthread_t thread_agent; + int retries; + List bg_destroy_list = list_create(NULL); + + num_block_to_free = 0; + num_block_freed = 0; + + if(!bg_recover) { + if(bg_curr_block_list) { + itr_curr = list_iterator_create(bg_curr_block_list); + while ((init_record = (bg_record_t*) + list_next(itr_curr))) { + slurm_attr_init(&attr_agent); + if (pthread_attr_setdetachstate( + &attr_agent, + PTHREAD_CREATE_JOINABLE)) + error("pthread_attr_setdetach" + "state error %m"); + + list_push(bg_destroy_list, init_record); + retries = 0; + while (pthread_create(&thread_agent, + &attr_agent, + mult_destroy_block, + (void *) + init_record)) { + error("pthread_create " + "error %m"); + if (++retries + > MAX_PTHREAD_RETRIES) + fatal("Can't create " + "pthread"); + /* sleep and retry */ + usleep(1000); + } + num_block_to_free++; + } + list_iterator_destroy(itr_curr); + } else { + error("_delete_old_blocks: " + "no bg_curr_block_list 1"); + return SLURM_ERROR; + } + } else { + if(bg_curr_block_list) { + itr_curr = list_iterator_create(bg_curr_block_list); + while ((init_record = (bg_record_t*) + list_next(itr_curr))) { + if(bg_found_block_list) { + itr_found = list_iterator_create( + bg_found_block_list); + while ((found_record = (bg_record_t*) + list_next(itr_found)) + != NULL) { + if (!strcmp(init_record-> + bg_block_id, + found_record-> + bg_block_id)) { + /* don't delete + this one + */ + break; + } + } + list_iterator_destroy(itr_found); + } else { + error("_delete_old_blocks: " + "no bg_found_block_list"); + return SLURM_ERROR; + } + if(found_record == NULL) { + slurm_attr_init(&attr_agent); + if (pthread_attr_setdetachstate( + &attr_agent, + PTHREAD_CREATE_JOINABLE)) + error("pthread_attr_setdetach" + "state error %m"); + + list_push(bg_destroy_list, + init_record); + retries = 0; + while (pthread_create( + &thread_agent, + &attr_agent, + mult_destroy_block, + (void *)init_record)) { + error("pthread_create " + "error %m"); + if (++retries + > MAX_PTHREAD_RETRIES) + fatal("Can't create " + "pthread"); + /* sleep and retry */ + usleep(1000); + } + num_block_to_free++; + } + } + list_iterator_destroy(itr_curr); + } else { + error("_delete_old_blocks: " + "no bg_curr_block_list 2"); + return SLURM_ERROR; + } + } + retries=30; + while(num_block_to_free != num_block_freed) { + _update_bg_record_state(bg_destroy_list); + if(retries==30) { + info("Waiting for old blocks to be " + "freed. Have %d of %d", + num_block_freed, + num_block_to_free); + retries=0; + } + retries++; + sleep(1); + } + list_destroy(bg_destroy_list); + +#endif + return SLURM_SUCCESS; +} + +static char *_get_bg_conf(void) +{ + char *val = getenv("SLURM_CONF"); + char *rc; + int i; + + if (!val) + return xstrdup(BLUEGENE_CONFIG_FILE); + + /* Replace file name on end of path */ + i = strlen(val) - strlen("slurm.conf") + strlen("bluegene.conf") + 1; + rc = xmalloc(i); + strcpy(rc, val); + val = strrchr(rc, (int)'/'); + if (val) /* absolute path */ + val++; + else /* not absolute path */ + val = rc; + strcpy(val, "bluegene.conf"); + return rc; +} + +/* Explicitly strip out new-line and carriage-return */ +static void _strip_13_10(char *line) +{ + int len = strlen(line); + int i; + + for(i=0;i<len;i++) { + if(line[i]==13 || line[i]==10) { + line[i] = '\0'; + return; + } + } +} + +/* + * + * _parse_bg_spec - parse the block specification, build table and + * set values + * IN/OUT in_line - line from the configuration file, parsed keywords + * and values replaced by blanks + * RET 0 if no error, error code otherwise + * Note: Operates on common variables + * global: block_list - global block list pointer + * default_block - default parameters for a block + */ +static int _parse_bg_spec(char *in_line) +{ + int error_code = SLURM_SUCCESS; + char *nodes = NULL, *conn_type = NULL; + char *blrts_image = NULL, *linux_image = NULL; + char *mloader_image = NULL, *ramdisk_image = NULL; + char *api_file = NULL; + int pset_num=-1, api_verb=-1; + bg_record_t *bg_record = NULL; + bg_record_t *small_bg_record = NULL; + ba_node_t *ba_node = NULL; + struct passwd *pw_ent = NULL; + ListIterator itr; + int i=0; + + //info("in_line = %s",in_line); + error_code = slurm_parser(in_line, + "BlrtsImage=", 's', &blrts_image, + "LinuxImage=", 's', &linux_image, + "MloaderImage=", 's', &mloader_image, + "Numpsets=", 'd', &pset_num, + "BridgeAPIVerbose=", 'd', &api_verb, + "BridgeAPILogFile=", 's', &api_file, + "Nodes=", 's', &nodes, + "RamDiskImage=", 's', &ramdisk_image, + "Type=", 's', &conn_type, + "END"); + + if (error_code) + return SLURM_ERROR; + + /* Process system-wide info */ + if (blrts_image) { + xfree(bluegene_blrts); + bluegene_blrts = blrts_image; + blrts_image = NULL; /* nothing left to xfree */ + } + if (linux_image) { + xfree(bluegene_linux); + bluegene_linux = linux_image; + linux_image = NULL; /* nothing left to xfree */ + } + if (mloader_image) { + xfree(bluegene_mloader); + bluegene_mloader = mloader_image; + mloader_image = NULL; /* nothing left to xfree */ + } + if (ramdisk_image) { + xfree(bluegene_ramdisk); + bluegene_ramdisk = ramdisk_image; + ramdisk_image = NULL; /* nothing left to xfree */ + } + if (api_file) { + xfree(bridge_api_file); + bridge_api_file = api_file; + api_file = NULL; /* nothing left to xfree */ + } + if (pset_num > 0) { + numpsets = pset_num; + } + if (api_verb >= 0) { + bridge_api_verb = api_verb; + } + + /* Process node information */ + if (!nodes) + return SLURM_SUCCESS; /* not block line. */ + + bg_record = (bg_record_t*) xmalloc(sizeof(bg_record_t)); + + bg_record->user_name = + xstrdup(slurmctld_conf.slurm_user_name); + if((pw_ent = getpwnam(bg_record->user_name)) == NULL) { + error("getpwnam(%s): %m", bg_record->user_name); + } else { + bg_record->user_uid = pw_ent->pw_uid; + } + bg_record->bg_block_list = list_create(NULL); + bg_record->hostlist = hostlist_create(NULL); + /* bg_record->boot_state = 0; Implicit */ + /* bg_record->state = 0; Implicit */ + api_verb = strlen(nodes); + i=0; + while((nodes[i] != '[' + && (nodes[i] > 57 || nodes[i] < 48)) + && (i<api_verb)) { + + i++; + } + if(i<api_verb) { + api_verb -= i; + bg_record->nodes = xmalloc(sizeof(char)* + (api_verb + +strlen(slurmctld_conf.node_prefix) + +1)); + + sprintf(bg_record->nodes, "%s%s\0", + slurmctld_conf.node_prefix, nodes+i); + } else + fatal("Nodes=%s is in a weird format", nodes); + xfree(nodes); + + _process_nodes(bg_record); + if (!conn_type || !strcasecmp(conn_type,"TORUS")) + bg_record->conn_type = SELECT_TORUS; + else if(!strcasecmp(conn_type,"MESH")) + bg_record->conn_type = SELECT_MESH; + else + bg_record->conn_type = SELECT_SMALL; + xfree(conn_type); + + bg_record->node_use = SELECT_COPROCESSOR_MODE; + bg_record->cnodes_per_bp = procs_per_node; + bg_record->quarter = -1; + + if(bg_record->conn_type != SELECT_SMALL) + list_append(bg_list, bg_record); + else { + /* Automatically create 4-way split if + * conn_type == SELECT_SMALL in bluegene.conf + */ + itr = list_iterator_create(bg_record->bg_block_list); + while ((ba_node = list_next(itr)) != NULL) { + for(i=0; i<4 ; i++) { + small_bg_record = (bg_record_t*) + xmalloc(sizeof(bg_record_t)); + list_append(bg_list, small_bg_record); + + small_bg_record->user_name = + xstrdup(bg_record->user_name); + small_bg_record->user_uid = + bg_record->user_uid; + small_bg_record->bg_block_list = + list_create(NULL); + small_bg_record->hostlist = + hostlist_create(NULL); + small_bg_record->nodes = + xstrdup(bg_record->nodes); + + _process_nodes(small_bg_record); + + small_bg_record->conn_type = + SELECT_SMALL; + + small_bg_record->node_use = + SELECT_COPROCESSOR_MODE; + + small_bg_record->cnodes_per_bp = + procs_per_node/4; + small_bg_record->quarter = i; + } + } + list_iterator_destroy(itr); + destroy_bg_record(bg_record); + } + + return SLURM_SUCCESS; +} + +static void _process_nodes(bg_record_t *bg_record) +{ +#ifdef HAVE_BG + int j=0, number; + int start[BA_SYSTEM_DIMENSIONS]; + int end[BA_SYSTEM_DIMENSIONS]; + ListIterator itr; + ba_node_t* ba_node = NULL; + + bg_record->bp_count = 0; + + while (bg_record->nodes[j] != '\0') { + if ((bg_record->nodes[j] == '[' + || bg_record->nodes[j] == ',') + && (bg_record->nodes[j+8] == ']' + || bg_record->nodes[j+8] == ',') + && (bg_record->nodes[j+4] == 'x' + || bg_record->nodes[j+4] == '-')) { + j++; + number = atoi(bg_record->nodes + j); + start[X] = number / 100; + start[Y] = (number % 100) / 10; + start[Z] = (number % 10); + j += 4; + number = atoi(bg_record->nodes + j); + end[X] = number / 100; + end[Y] = (number % 100) / 10; + end[Z] = (number % 10); + j += 3; + if(!bg_record->bp_count) { + bg_record->start[X] = start[X]; + bg_record->start[Y] = start[Y]; + bg_record->start[Z] = start[Z]; + debug2("start is %d%d%d", + bg_record->start[X], + bg_record->start[Y], + bg_record->start[Z]); + } + bg_record->bp_count += _addto_node_list(bg_record, + start, + end); + if(bg_record->nodes[j] != ',') + break; + j--; + } else if((bg_record->nodes[j] < 58 + && bg_record->nodes[j] > 47)) { + + number = atoi(bg_record->nodes + j); + start[X] = number / 100; + start[Y] = (number % 100) / 10; + start[Z] = (number % 10); + j+=3; + if(!bg_record->bp_count) { + bg_record->start[X] = start[X]; + bg_record->start[Y] = start[Y]; + bg_record->start[Z] = start[Z]; + debug2("start is %d%d%d", + bg_record->start[X], + bg_record->start[Y], + bg_record->start[Z]); + } + bg_record->bp_count += _addto_node_list(bg_record, + start, + start); + if(bg_record->nodes[j] != ',') + break; + } + j++; + } + j=0; + bg_record->geo[X] = 0; + bg_record->geo[Y] = 0; + bg_record->geo[Z] = 0; + end[X] = -1; + end[Y] = -1; + end[Z] = -1; + + itr = list_iterator_create(bg_record->bg_block_list); + while ((ba_node = list_next(itr)) != NULL) { + if(ba_node->coord[X]>end[X]) { + bg_record->geo[X]++; + end[X] = ba_node->coord[X]; + } + if(ba_node->coord[Y]>end[Y]) { + bg_record->geo[Y]++; + end[Y] = ba_node->coord[Y]; + } + if(ba_node->coord[Z]>end[Z]) { + bg_record->geo[Z]++; + end[Z] = ba_node->coord[Z]; + } + } + list_iterator_destroy(itr); + debug3("geo = %d%d%d\n", + bg_record->geo[X], + bg_record->geo[Y], + bg_record->geo[Z]); + +#ifndef HAVE_BG_FILES + max_dim[X] = MAX(max_dim[X], end[X]); + max_dim[Y] = MAX(max_dim[Y], end[Y]); + max_dim[Z] = MAX(max_dim[Z], end[Z]); +#endif + + if (node_name2bitmap(bg_record->nodes, + false, + &bg_record->bitmap)) { + error("Unable to convert nodes %s to bitmap", + bg_record->nodes); + } +#endif + return; +} + +static int _reopen_bridge_log(void) +{ + static FILE *fp = NULL; + + if (bridge_api_file == NULL) + return SLURM_SUCCESS; + + if(fp) + fclose(fp); + fp = fopen(bridge_api_file,"a"); + if (fp == NULL) { + error("can't open file for bridgeapi.log at %s: %m", + bridge_api_file); + return SLURM_ERROR; + } + +#ifdef HAVE_BG_FILES + setSayMessageParams(fp, bridge_api_verb); +#else + if (fprintf(fp, "bridgeapi.log to write here at level %d\n", + bridge_api_verb) < 20) { + error("can't write to bridgeapi.log: %m"); + return SLURM_ERROR; + } +#endif + + return SLURM_SUCCESS; +} + diff --git a/src/plugins/select/bluegene/bluegene.h b/src/plugins/select/bluegene/plugin/bluegene.h similarity index 52% rename from src/plugins/select/bluegene/bluegene.h rename to src/plugins/select/bluegene/plugin/bluegene.h index 27827ac6761bbcb1392390ca51c438b73c896315..9141ed61e6c09c0799a036487414dddc3aa67ca6 100644 --- a/src/plugins/select/bluegene/bluegene.h +++ b/src/plugins/select/bluegene/plugin/bluegene.h @@ -41,29 +41,29 @@ #include "src/common/list.h" #include "src/common/macros.h" #include "src/slurmctld/slurmctld.h" -#include "src/partition_allocator/partition_allocator.h" -#include "src/plugins/select/bluegene/wrap_rm_api.h" +#include "../block_allocator/block_allocator.h" +#include "../wrap_rm_api.h" typedef int lifecycle_type_t; -enum part_lifecycle {DYNAMIC, STATIC}; +enum block_lifecycle {DYNAMIC, STATIC}; -typedef struct bgl_record { - char *nodes; /* String of nodes in partition */ - char *user_name; /* user using the partition */ - char *target_name; /* when a partition is freed this +typedef struct bg_record { + char *nodes; /* String of nodes in block */ + char *user_name; /* user using the block */ + char *target_name; /* when a block is freed this is the name of the user we - want on the partition */ - uid_t user_uid; /* Owner of partition uid */ - pm_partition_id_t bgl_part_id; /* ID returned from MMCS */ - lifecycle_type_t part_lifecycle;/* either STATIC or DYNAMIC */ - rm_partition_state_t state; /* the allocated partition */ - int start[PA_SYSTEM_DIMENSIONS];/* start node */ - int geo[PA_SYSTEM_DIMENSIONS]; /* geometry */ + want on the block */ + uid_t user_uid; /* Owner of block uid */ + pm_partition_id_t bg_block_id; /* ID returned from MMCS */ + lifecycle_type_t block_lifecycle;/* either STATIC or DYNAMIC */ + rm_partition_state_t state; /* the allocated block */ + int start[BA_SYSTEM_DIMENSIONS];/* start node */ + int geo[BA_SYSTEM_DIMENSIONS]; /* geometry */ rm_connection_type_t conn_type; /* Mesh or Torus or NAV */ rm_partition_mode_t node_use; /* either COPROCESSOR or VIRTUAL */ - rm_partition_t *bgl_part; /* structure to hold info from db2 */ - List bgl_part_list; /* node list of blocks in partition */ + rm_partition_t *bg_block; /* structure to hold info from db2 */ + List bg_block_list; /* node list of blocks in block */ hostlist_t hostlist; /* expanded form of hosts */ int bp_count; /* size */ int switch_count; /* number of switches used. */ @@ -73,144 +73,132 @@ typedef struct bgl_record { 1 = booting */ int boot_count; /* number of attemts boot attempts */ bitstr_t *bitmap; /* bitmap to check the name - of partition */ - int full_partition; /* wether or not partition is the full - partition */ + of block */ + int full_block; /* wether or not block is the full + block */ int job_running; /* job id if there is a job running - on the partition */ - int cnodes_per_bp; /* count of cnodes per Base part */ - int quarter; /* used for small partitions + on the block */ + int cnodes_per_bp; /* count of cnodes per Base block */ + int quarter; /* used for small blocks determine quarter of BP */ -} bgl_record_t; +} bg_record_t; typedef struct { int source; int target; -} bgl_conn_t; +} bg_conn_t; typedef struct { int dim; List conn_list; -} bgl_switch_t; +} bg_switch_t; typedef struct { int *coord; int used; List switch_list; -} bgl_bp_t; +} bg_bp_t; /* Global variables */ -extern rm_BGL_t *bgl; +extern rm_BGL_t *bg; extern char *bluegene_blrts; extern char *bluegene_linux; extern char *bluegene_mloader; extern char *bluegene_ramdisk; extern char *bridge_api_file; extern int numpsets; -extern pa_system_t *pa_system_ptr; -extern time_t last_bgl_update; -extern List bgl_curr_part_list; /* Initial bgl partition state */ -extern List bgl_list; /* List of configured BGL blocks */ +extern ba_system_t *ba_system_ptr; +extern time_t last_bg_update; +extern List bg_curr_block_list; /* Initial bg block state */ +extern List bg_list; /* List of configured BG blocks */ extern bool agent_fini; -extern pthread_mutex_t part_state_mutex; -extern int num_part_to_free; -extern int num_part_freed; -extern int partitions_are_created; +extern pthread_mutex_t block_state_mutex; +extern int num_block_to_free; +extern int num_block_freed; +extern int blocks_are_created; extern int procs_per_node; -extern bgl_record_t *full_system_partition; +extern bg_record_t *full_system_block; #define MAX_PTHREAD_RETRIES 1 -#include "bgl_part_info.h" -#include "bgl_job_place.h" -#include "bgl_job_run.h" +#include "bg_block_info.h" +#include "bg_job_place.h" +#include "bg_job_run.h" #include "state_test.h" -/* - * bgl_conf_record is used to store the elements read from the bluegene.conf - * file and is loaded by init(). - */ -/* typedef struct bgl_conf_record { */ -/* char* nodes; */ -/* rm_connection_type_t conn_type;/\* Mesh or Torus or NAV *\/ */ -/* rm_partition_mode_t node_use; */ -/* rm_partition_t *bgl_part; */ -/* } bgl_conf_record_t; */ - - /* bluegene.c */ /**********************************************/ /* Initialize all plugin variables */ -extern int init_bgl(void); +extern int init_bg(void); /* Purge all plugin variables */ -extern void fini_bgl(void); +extern void fini_bg(void); -/* Log a bgl_record's contents */ -extern void print_bgl_record(bgl_record_t* record); -extern void destroy_bgl_record(void* object); +/* Log a bg_record's contents */ +extern void print_bg_record(bg_record_t* record); +extern void destroy_bg_record(void* object); -/* return bgl_record from bgl_list */ -extern bgl_record_t *find_bgl_record(char *bgl_part_id); +/* return bg_record from bg_list */ +extern bg_record_t *find_bg_record(char *bg_block_id); -/* change username of a partition bgl_record_t target_name needs to be +/* change username of a block bg_record_t target_name needs to be updated before call of function. */ -extern int update_partition_user(bgl_record_t *bgl_part_id); +extern int update_block_user(bg_record_t *bg_block_id); -/* remove all users from a partition but what is in user_name */ +/* remove all users from a block but what is in user_name */ /* Note return codes */ #define REMOVE_USER_ERR -1 #define REMOVE_USER_NONE 0 #define REMOVE_USER_FOUND 2 -extern int remove_all_users(char *bgl_part_id, char *user_name); -extern void set_part_user(bgl_record_t *bgl_record); +extern int remove_all_users(char *bg_block_id, char *user_name); +extern void set_block_user(bg_record_t *bg_record); /* Return strings representing blue gene data types */ extern char *convert_lifecycle(lifecycle_type_t lifecycle); extern char *convert_conn_type(rm_connection_type_t conn_type); extern char *convert_node_use(rm_partition_mode_t pt); -/* sort a list of bgl_records by size (node count) */ -extern void sort_bgl_record_inc_size(List records); +/* sort a list of bg_records by size (node count) */ +extern void sort_bg_record_inc_size(List records); /* bluegene_agent - detached thread periodically tests status of bluegene * nodes and switches */ extern void *bluegene_agent(void *args); /* - * Convert a BGL API error code to a string - * IN inx - error code from any of the BGL Bridge APIs + * Convert a BG API error code to a string + * IN inx - error code from any of the BG Bridge APIs * RET - string describing the error condition */ -extern char *bgl_err_str(status_t inx); +extern char *bg_err_str(status_t inx); /* - * create_static_partitions - create the static partitions that will be used + * create_static_blocks - create the static blocks that will be used * for scheduling. - * IN/OUT part_list - (global, from slurmctld): SLURM's partition - * configurations. Fill in bgl_part_id + * IN/OUT block_list - (global, from slurmctld): SLURM's block + * configurations. Fill in bg_block_id * RET - success of fitting all configurations */ -extern int create_static_partitions(List part_list); +extern int create_static_blocks(List block_list); -extern int bgl_free_partition(bgl_record_t *bgl_record); -extern void *mult_free_part(void *args); -extern void *mult_destroy_part(void *args); -extern int read_bgl_conf(void); +extern int bg_free_block(bg_record_t *bg_record); +extern void *mult_free_block(void *args); +extern void *mult_destroy_block(void *args); +extern int read_bg_conf(void); -/* partition_sys.c */ +/* block_sys.c */ /*****************************************************/ -extern int configure_partition(bgl_record_t * bgl_conf_record); -extern int read_bgl_partitions(); +extern int configure_block(bg_record_t * bg_conf_record); +extern int read_bg_blocks(); -/* bgl_switch_connections.c */ +/* bg_switch_connections.c */ /*****************************************************/ -extern int configure_small_partition(bgl_record_t *bgl_record); -extern int configure_partition_switches(bgl_record_t * bgl_conf_record); +extern int configure_small_block(bg_record_t *bg_record); +extern int configure_block_switches(bg_record_t * bg_conf_record); #endif /* _BLUEGENE_H_ */ diff --git a/src/plugins/select/bluegene/opts.c b/src/plugins/select/bluegene/plugin/opts.c similarity index 94% rename from src/plugins/select/bluegene/opts.c rename to src/plugins/select/bluegene/plugin/opts.c index d5588ef86cd5f935a1183f18977d18e46d256d38..1a91207f1ee6067fffe46289860b41af8ebf9a38 100644 --- a/src/plugins/select/bluegene/opts.c +++ b/src/plugins/select/bluegene/plugin/opts.c @@ -42,7 +42,7 @@ void parse_command_line(int argc, char *argv[]) static struct option long_options[] = { {"all", no_argument, 0, 'a'}, - {"bglblock", required_argument, 0, 'b'}, + {"bgblock", required_argument, 0, 'b'}, {"partition", required_argument, 0, 'p'}, {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, @@ -60,14 +60,14 @@ void parse_command_line(int argc, char *argv[]) exit(1); break; case (int) 'a': - all_parts = 1; + all_blocks = 1; break; case (int) 'V': _print_version(); exit(0); case (int) 'b': case (int) 'p': - bgl_part_id = optarg; + bg_block_id = optarg; break; case (int) 'h': case (int) OPT_LONG_HELP: @@ -124,8 +124,8 @@ static void _help(void) printf("\ Usage: sfree [OPTIONS]\n\ - -b, --bglblock free specific bglblock named\n\ - -a, --all free all bglblocks\n\ + -b, --bgblock free specific bgblock named\n\ + -a, --all free all bgblocks\n\ -V, --version output version information and exit\n\ \nHelp options:\n\ --help show this help message\n\ diff --git a/src/plugins/select/bluegene/select_bluegene.c b/src/plugins/select/bluegene/plugin/select_bluegene.c similarity index 85% rename from src/plugins/select/bluegene/select_bluegene.c rename to src/plugins/select/bluegene/plugin/select_bluegene.c index cdaec1c5ac1b215681b6d90b275e667d4683dbe5..a8b69bba7b222926cf7408c63c654df7fdab8928 100644 --- a/src/plugins/select/bluegene/select_bluegene.c +++ b/src/plugins/select/bluegene/plugin/select_bluegene.c @@ -66,7 +66,7 @@ const char plugin_name[] = "Blue Gene node selection plugin"; const char plugin_type[] = "select/bluegene"; const uint32_t plugin_version = 90; -/* pthread stuff for updating BGL node status */ +/* pthread stuff for updating BG node status */ static pthread_t bluegene_thread = 0; static pthread_mutex_t thread_flag_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -79,14 +79,14 @@ static int _init_status_pthread(void); */ extern int init ( void ) { -#ifndef HAVE_BGL +#ifndef HAVE_BG fatal("Plugin select/bluegene is illegal on non-BlueGene computers"); #endif #if (SYSTEM_DIMENSIONS != 3) fatal("SYSTEM_DIMENSIONS value (%d) invalid for Blue Gene", SYSTEM_DIMENSIONS); #endif -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES if (!getenv("CLASSPATH") || !getenv("DB2INSTANCE") || !getenv("VWSPATH")) fatal("db2profile has not been run to setup DB2 environment"); @@ -102,7 +102,7 @@ extern int init ( void ) #endif verbose("%s loading...", plugin_name); - if (init_bgl() || _init_status_pthread()) + if (init_bg() || _init_status_pthread()) return SLURM_ERROR; return SLURM_SUCCESS; @@ -155,7 +155,7 @@ extern int fini ( void ) } pthread_mutex_unlock( &thread_flag_mutex ); - fini_bgl(); + fini_bg(); return rc; } @@ -167,29 +167,28 @@ extern int fini ( void ) /* * Called by slurmctld when a new configuration file is loaded - * or scontrol is used to change partition configuration + * or scontrol is used to change block configuration */ - extern int select_p_part_init(List part_list) + extern int select_p_block_init(List part_list) { xassert(part_list); -#ifdef HAVE_BGL - if(read_bgl_conf() == SLURM_ERROR) { +#ifdef HAVE_BG + if(read_bg_conf() == SLURM_ERROR) { fatal("Error, could not read the file"); return SLURM_ERROR; } #else - /*looking for partitions only I created */ - if (create_static_partitions(part_list) == SLURM_ERROR) { - /* error in creating the static partitions, so - * partitions referenced by submitted jobs won't - * correspond to actual slurm partitions/bgl - * partitions. + /*looking for blocks only I created */ + if (create_static_blocks(part_list) == SLURM_ERROR) { + /* error in creating the static blocks, so + * blocks referenced by submitted jobs won't + * correspond to actual slurm blocks. */ - fatal("Error, could not create the static partitions"); + fatal("Error, could not create the static blocks"); return SLURM_ERROR; } #endif - sort_bgl_record_inc_size(bgl_list); + sort_bg_record_inc_size(bg_list); return SLURM_SUCCESS; } @@ -205,13 +204,13 @@ extern int select_p_state_restore(char *dir_name) return SLURM_SUCCESS; } -/* Sync BGL blocks to currently active jobs */ +/* Sync BG blocks to currently active jobs */ extern int select_p_job_init(List job_list) { return sync_jobs(job_list); } -/* All initialization is performed by select_p_part_init() */ +/* All initialization is performed by select_p_block_init() */ extern int select_p_node_init(struct node_record *node_ptr, int node_cnt) { if(node_cnt>0) @@ -237,14 +236,14 @@ extern int select_p_node_init(struct node_record *node_ptr, int node_cnt) extern int select_p_job_test(struct job_record *job_ptr, bitstr_t *bitmap, int min_nodes, int max_nodes) { - /* bgl partition test - is there a partition where we have: + /* bg block test - is there a block where we have: * 1) geometry requested * 2) min/max nodes (BPs) requested * 3) type: TORUS or MESH or NAV (torus else mesh) * 4) use: VIRTUAL or COPROCESSOR * * note: we don't have to worry about security at this level - * as the SLURM partition logic will handle access rights. + * as the SLURM block logic will handle access rights. */ return submit_job(job_ptr, bitmap, min_nodes, max_nodes); @@ -262,8 +261,8 @@ extern int select_p_job_fini(struct job_record *job_ptr) extern int select_p_job_ready(struct job_record *job_ptr) { -#ifdef HAVE_BGL_FILES - return part_ready(job_ptr); +#ifdef HAVE_BG_FILES + return block_ready(job_ptr); #else if (job_ptr->job_state == JOB_RUNNING) return 1; @@ -274,38 +273,38 @@ extern int select_p_job_ready(struct job_record *job_ptr) extern int select_p_pack_node_info(time_t last_query_time, Buf *buffer_ptr) { ListIterator itr; - bgl_record_t *bgl_record = NULL; - uint32_t partitions_packed = 0, tmp_offset; + bg_record_t *bg_record = NULL; + uint32_t blocks_packed = 0, tmp_offset; Buf buffer; /* check to see if data has changed */ - if (last_query_time >= last_bgl_update) { + if (last_query_time >= last_bg_update) { debug2("Node select info hasn't changed since %d", - last_bgl_update); + last_bg_update); return SLURM_NO_CHANGE_IN_DATA; } else { *buffer_ptr = NULL; buffer = init_buf(HUGE_BUF_SIZE); - pack32(partitions_packed, buffer); - pack_time(last_bgl_update, buffer); + pack32(blocks_packed, buffer); + pack_time(last_bg_update, buffer); - if(bgl_list) { - itr = list_iterator_create(bgl_list); - while ((bgl_record = (bgl_record_t *) list_next(itr)) + if(bg_list) { + itr = list_iterator_create(bg_list); + while ((bg_record = (bg_record_t *) list_next(itr)) != NULL) { - xassert(bgl_record->bgl_part_id != NULL); + xassert(bg_record->bg_block_id != NULL); - pack_partition(bgl_record, buffer); - partitions_packed++; + pack_block(bg_record, buffer); + blocks_packed++; } list_iterator_destroy(itr); } else { - error("select_p_pack_node_info: no bgl_list"); + error("select_p_pack_node_info: no bg_list"); return SLURM_ERROR; } tmp_offset = get_buf_offset(buffer); set_buf_offset(buffer, 0); - pack32(partitions_packed, buffer); + pack32(blocks_packed, buffer); set_buf_offset(buffer, tmp_offset); *buffer_ptr = buffer; diff --git a/src/plugins/select/bluegene/sfree.c b/src/plugins/select/bluegene/plugin/sfree.c similarity index 71% rename from src/plugins/select/bluegene/sfree.c rename to src/plugins/select/bluegene/plugin/sfree.c index e1726086ab942047a65e7b25f49805879d463da0..23ad76598cb86a91dce4579d113b1714ee5c8f56 100644 --- a/src/plugins/select/bluegene/sfree.c +++ b/src/plugins/select/bluegene/plugin/sfree.c @@ -34,18 +34,18 @@ /* Globals */ -int all_parts = 0; -char *bgl_part_id = NULL; +int all_blocks = 0; +char *bg_block_id = NULL; -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES -typedef struct bgl_records { - char *bgl_part_id; +typedef struct bg_records { + char *bg_block_id; int state; } delete_record_t; -static int num_part_to_free = 0; -static int num_part_freed = 0; +static int num_block_to_free = 0; +static int num_block_freed = 0; static pthread_mutex_t freed_cnt_mutex = PTHREAD_MUTEX_INITIALIZER; static bool _have_db2 = true; static List delete_record_list = NULL; @@ -55,10 +55,10 @@ static List delete_record_list = NULL; ************/ -static int _free_partition(delete_record_t *delete_record); -static int _update_bgl_record_state(); -static void _term_jobs_on_part(char *bgl_part_id); -static char *_bgl_err_str(status_t inx); +static int _free_block(delete_record_t *delete_record); +static int _update_bg_record_state(); +static void _term_jobs_on_block(char *bg_block_id); +static char *_bg_err_str(status_t inx); static int _remove_job(db_job_id_t job_id); @@ -67,21 +67,21 @@ static void _clean_destroy_list(void* object) delete_record_t* delete_record = (delete_record_t*) object; if (delete_record) { - xfree(delete_record->bgl_part_id); + xfree(delete_record->bg_block_id); xfree(delete_record); } } /* Free multiple partitions in parallel */ -static void *_mult_free_part(void *args) +static void *_mult_free_block(void *args) { delete_record_t *delete_record = (delete_record_t *) args; - debug("destroying the bglblock %s.", delete_record->bgl_part_id); - _free_partition(delete_record); + debug("destroying the bgblock %s.", delete_record->bg_block_id); + _free_block(delete_record); slurm_mutex_lock(&freed_cnt_mutex); - num_part_freed++; + num_block_freed++; slurm_mutex_unlock(&freed_cnt_mutex); return NULL; @@ -104,10 +104,10 @@ static void _db2_check(void) int main(int argc, char *argv[]) { log_options_t opts = LOG_OPTS_STDERR_ONLY; - rm_partition_list_t *part_list = NULL; - rm_partition_state_flag_t part_state = PARTITION_ALL_FLAG; - int j, num_parts = 0; - rm_partition_t *part_ptr = NULL; + rm_partition_list_t *block_list = NULL; + rm_partition_state_flag_t block_state = PARTITION_ALL_FLAG; + int j, num_blocks = 0; + rm_partition_t *block_ptr = NULL; int rc; pthread_attr_t attr_agent; pthread_t thread_agent; @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) _db2_check(); if (!_have_db2) { - printf("must be on BGL SN to resolve.\n"); + printf("must be on BG SN to resolve.\n"); exit(0); } @@ -125,13 +125,13 @@ int main(int argc, char *argv[]) delete_record_list = list_create(_clean_destroy_list); - if(!all_parts) { - if(!bgl_part_id) { - error("you need to specify a bglblock"); + if(!all_blocks) { + if(!bg_block_id) { + error("you need to specify a bgblock"); exit(0); } delete_record = xmalloc(sizeof(delete_record_t)); - delete_record->bgl_part_id = xstrdup(bgl_part_id); + delete_record->bg_block_id = xstrdup(bg_block_id); delete_record->state = -1; list_push(delete_record_list, delete_record); @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) retries = 0; while (pthread_create(&thread_agent, &attr_agent, - _mult_free_part, + _mult_free_block, (void *)delete_record)) { error("pthread_create " "error %m"); @@ -156,70 +156,70 @@ int main(int argc, char *argv[]) /* sleep and retry */ usleep(1000); } - num_part_to_free++; + num_block_to_free++; } else { - if ((rc = rm_get_partitions_info(part_state, &part_list)) + if ((rc = rm_get_partitions_info(block_state, &block_list)) != STATUS_OK) { error("rm_get_partitions_info(): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); return -1; } - if ((rc = rm_get_data(part_list, RM_PartListSize, &num_parts)) + if ((rc = rm_get_data(block_list, RM_PartListSize, &num_blocks)) != STATUS_OK) { error("rm_get_data(RM_PartListSize): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); - num_parts = 0; + num_blocks = 0; } - for (j=0; j<num_parts; j++) { + for (j=0; j<num_blocks; j++) { if (j) { - if ((rc = rm_get_data(part_list, + if ((rc = rm_get_data(block_list, RM_PartListNextPart, - &part_ptr)) + &block_ptr)) != STATUS_OK) { error("rm_get_data" "(RM_PartListNextPart): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); break; } } else { - if ((rc = rm_get_data(part_list, + if ((rc = rm_get_data(block_list, RM_PartListFirstPart, - &part_ptr)) + &block_ptr)) != STATUS_OK) { error("rm_get_data" "(RM_PartListFirstPart: %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); break; } } - if ((rc = rm_get_data(part_ptr, RM_PartitionID, - &bgl_part_id)) + if ((rc = rm_get_data(block_ptr, RM_PartitionID, + &bg_block_id)) != STATUS_OK) { error("rm_get_data(RM_PartitionID): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); break; } - if(!bgl_part_id) { + if(!bg_block_id) { error("No Part ID was returned from database"); continue; } - if(strncmp("RMP", bgl_part_id, 3)) { - free(bgl_part_id); + if(strncmp("RMP", bg_block_id, 3)) { + free(bg_block_id); continue; } delete_record = xmalloc(sizeof(delete_record_t)); - delete_record->bgl_part_id = xstrdup(bgl_part_id); + delete_record->bg_block_id = xstrdup(bg_block_id); - free(bgl_part_id); + free(bg_block_id); delete_record->state = -1; list_push(delete_record_list, delete_record); @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) retries = 0; while (pthread_create(&thread_agent, &attr_agent, - _mult_free_part, + _mult_free_block, (void *)delete_record)) { error("pthread_create " "error %m"); @@ -245,16 +245,16 @@ int main(int argc, char *argv[]) /* sleep and retry */ usleep(1000); } - num_part_to_free++; + num_block_to_free++; } - if ((rc = rm_free_partition_list(part_list)) != STATUS_OK) { + if ((rc = rm_free_partition_list(block_list)) != STATUS_OK) { error("rm_free_partition_list(): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); } } - while(num_part_to_free != num_part_freed) { - info("waiting for all bglblocks to free..."); - _update_bgl_record_state(); + while(num_block_to_free != num_block_freed) { + info("waiting for all bgblocks to free..."); + _update_bg_record_state(); sleep(1); } list_destroy(delete_record_list); @@ -262,28 +262,28 @@ int main(int argc, char *argv[]) return 0; } -static int _free_partition(delete_record_t *delete_record) +static int _free_block(delete_record_t *delete_record) { int state=-1; int rc; int i=0; - info("freeing bglblock %s", delete_record->bgl_part_id); - _term_jobs_on_part(delete_record->bgl_part_id); + info("freeing bgblock %s", delete_record->bg_block_id); + _term_jobs_on_block(delete_record->bg_block_id); while (1) { if (delete_record->state != -1 && delete_record->state != RM_PARTITION_FREE && delete_record->state != RM_PARTITION_DEALLOCATING) { - info("pm_destroy %s",delete_record->bgl_part_id); + info("pm_destroy %s",delete_record->bg_block_id); if ((rc = pm_destroy_partition( - delete_record->bgl_part_id)) + delete_record->bg_block_id)) != STATUS_OK) { if(rc == PARTITION_NOT_FOUND) { info("partition %s is not found"); break; } error("pm_destroy_partition(%s): %s", - delete_record->bgl_part_id, - _bgl_err_str(rc)); + delete_record->bg_block_id, + _bg_err_str(rc)); } } @@ -296,62 +296,62 @@ static int _free_partition(delete_record_t *delete_record) break; sleep(3); } - info("bglblock %s is freed", delete_record->bgl_part_id); + info("bgblock %s is freed", delete_record->bg_block_id); return SLURM_SUCCESS; } -static int _update_bgl_record_state() +static int _update_bg_record_state() { - rm_partition_state_flag_t part_state = PARTITION_ALL_FLAG; + rm_partition_state_flag_t block_state = PARTITION_ALL_FLAG; char *name = NULL; - rm_partition_list_t *part_list = NULL; - int j, rc, i, num_parts = 0; + rm_partition_list_t *block_list = NULL; + int j, rc, i, num_blocks = 0; rm_partition_state_t state = -2; - rm_partition_t *part_ptr = NULL; + rm_partition_t *block_ptr = NULL; delete_record_t *delete_record = NULL; ListIterator itr; - if ((rc = rm_get_partitions_info(part_state, &part_list)) + if ((rc = rm_get_partitions_info(block_state, &block_list)) != STATUS_OK) { - error("rm_get_partitions_info(): %s", _bgl_err_str(rc)); + error("rm_get_partitions_info(): %s", _bg_err_str(rc)); return -1; } - if ((rc = rm_get_data(part_list, RM_PartListSize, &num_parts)) + if ((rc = rm_get_data(block_list, RM_PartListSize, &num_blocks)) != STATUS_OK) { - error("rm_get_data(RM_PartListSize): %s", _bgl_err_str(rc)); + error("rm_get_data(RM_PartListSize): %s", _bg_err_str(rc)); state = -1; - num_parts = 0; + num_blocks = 0; } - for (j=0; j<num_parts; j++) { + for (j=0; j<num_blocks; j++) { if (j) { - if ((rc = rm_get_data(part_list, + if ((rc = rm_get_data(block_list, RM_PartListNextPart, - &part_ptr)) + &block_ptr)) != STATUS_OK) { error("rm_get_data(RM_PartListNextPart): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); state = -1; break; } } else { - if ((rc = rm_get_data(part_list, + if ((rc = rm_get_data(block_list, RM_PartListFirstPart, - &part_ptr)) + &block_ptr)) != STATUS_OK) { error("rm_get_data(RM_PartListFirstPart: %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); state = -1; break; } } - if ((rc = rm_get_data(part_ptr, + if ((rc = rm_get_data(block_ptr, RM_PartitionID, &name)) != STATUS_OK) { error("rm_get_data(RM_PartitionID): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); state = -1; break; } @@ -364,29 +364,29 @@ static int _update_bgl_record_state() itr = list_iterator_create(delete_record_list); while ((delete_record = (delete_record_t*) list_next(itr))) { - if(!delete_record->bgl_part_id) + if(!delete_record->bg_block_id) continue; - if(strcmp(delete_record->bgl_part_id, name)) { + if(strcmp(delete_record->bg_block_id, name)) { continue; } if(state == -1) goto clean_up; - else if(j>=num_parts) { - error("This bglblock, %s, " + else if(j>=num_blocks) { + error("This bgblock, %s, " "doesn't exist in MMCS", - bgl_part_id); + bg_block_id); state = -1; goto clean_up; } - if ((rc = rm_get_data(part_ptr, + if ((rc = rm_get_data(block_ptr, RM_PartitionState, &delete_record->state)) != STATUS_OK) { error("rm_get_data" "(RM_PartitionState): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); } break; } @@ -394,20 +394,20 @@ static int _update_bgl_record_state() free(name); } clean_up: - if ((rc = rm_free_partition_list(part_list)) != STATUS_OK) { - error("rm_free_partition_list(): %s", _bgl_err_str(rc)); + if ((rc = rm_free_partition_list(block_list)) != STATUS_OK) { + error("rm_free_partition_list(): %s", _bg_err_str(rc)); } return state; } /* Perform job termination work */ -static void _term_jobs_on_part(char *bgl_part_id) +static void _term_jobs_on_block(char *bg_block_id) { int i, jobs, rc, job_found = 0; rm_job_list_t *job_list; int live_states; rm_element_t *job_elem; - pm_partition_id_t part_id; + pm_partition_id_t block_id; db_job_id_t job_id; //debug("getting the job info"); @@ -415,12 +415,12 @@ static void _term_jobs_on_part(char *bgl_part_id) & (~JOB_TERMINATED_FLAG) & (~JOB_KILLED_FLAG); if ((rc = rm_get_jobs(live_states, &job_list)) != STATUS_OK) { - error("rm_get_jobs(): %s", _bgl_err_str(rc)); + error("rm_get_jobs(): %s", _bg_err_str(rc)); return; } if ((rc = rm_get_data(job_list, RM_JobListSize, &jobs)) != STATUS_OK) { - error("rm_get_data(RM_JobListSize): %s", _bgl_err_str(rc)); + error("rm_get_data(RM_JobListSize): %s", _bg_err_str(rc)); jobs = 0; } else if (jobs > 300) fatal("Active job count (%d) invalid, restart MMCS", jobs); @@ -430,14 +430,14 @@ static void _term_jobs_on_part(char *bgl_part_id) if ((rc = rm_get_data(job_list, RM_JobListNextJob, &job_elem)) != STATUS_OK) { error("rm_get_data(RM_JobListNextJob): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); continue; } } else { if ((rc = rm_get_data(job_list, RM_JobListFirstJob, &job_elem)) != STATUS_OK) { error("rm_get_data(RM_JobListFirstJob): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); continue; } } @@ -447,28 +447,28 @@ static void _term_jobs_on_part(char *bgl_part_id) jobs); break; } - if ((rc = rm_get_data(job_elem, RM_JobPartitionID, &part_id)) + if ((rc = rm_get_data(job_elem, RM_JobPartitionID, &block_id)) != STATUS_OK) { error("rm_get_data(RM_JobPartitionID) %s: %s", - part_id, _bgl_err_str(rc)); + block_id, _bg_err_str(rc)); continue; } - if(!part_id) { + if(!block_id) { error("No Partition ID was returned from database"); continue; } - if (strcmp(part_id, bgl_part_id) != 0) { - free(part_id); + if (strcmp(block_id, bg_block_id) != 0) { + free(block_id); continue; } - free(part_id); + free(block_id); job_found = 1; if ((rc = rm_get_data(job_elem, RM_JobDBJobID, &job_id)) != STATUS_OK) { error("rm_get_data(RM_JobDBJobID): %s", - _bgl_err_str(rc)); + _bg_err_str(rc)); continue; } info("got job_id %d",job_id); @@ -477,19 +477,19 @@ static void _term_jobs_on_part(char *bgl_part_id) } } if(job_found == 0) - info("No jobs on bglblock %s", bgl_part_id); + info("No jobs on bgblock %s", bg_block_id); not_removed: if ((rc = rm_free_job_list(job_list)) != STATUS_OK) - error("rm_free_job_list(): %s", _bgl_err_str(rc)); + error("rm_free_job_list(): %s", _bg_err_str(rc)); } /* - * Convert a BGL API error code to a string - * IN inx - error code from any of the BGL Bridge APIs + * Convert a BG API error code to a string + * IN inx - error code from any of the BG Bridge APIs * RET - string describing the error condition */ -static char *_bgl_err_str(status_t inx) +static char *_bg_err_str(status_t inx) { switch (inx) { case STATUS_OK: @@ -538,7 +538,7 @@ static int _remove_job(db_job_id_t job_id) } error("rm_get_job(%d): %s", job_id, - _bgl_err_str(rc)); + _bg_err_str(rc)); continue; } @@ -551,11 +551,11 @@ static int _remove_job(db_job_id_t job_id) } error("rm_get_data(RM_JobState) for jobid=%d " - "%s", job_id, _bgl_err_str(rc)); + "%s", job_id, _bg_err_str(rc)); continue; } if ((rc = rm_free_job(job_rec)) != STATUS_OK) - error("rm_free_job: %s", _bgl_err_str(rc)); + error("rm_free_job: %s", _bg_err_str(rc)); info("job %d is in state %d", job_id, job_state); @@ -567,7 +567,7 @@ static int _remove_job(db_job_id_t job_id) else if(job_state == RM_JOB_ERROR) { error("job %d is in a error state.", job_id); - //free_bgl_partition(); + //free_bg_block(); return STATUS_OK; } @@ -583,7 +583,7 @@ static int _remove_job(db_job_id_t job_id) job_id); else error("rm_cancel_job(%d): %s", job_id, - _bgl_err_str(rc)); + _bg_err_str(rc)); } } error("Failed to remove job %d from MMCS", job_id); @@ -594,7 +594,7 @@ static int _remove_job(db_job_id_t job_id) int main(int argc, char *argv[]) { - printf("Only can be ran on the service node of a BGL system.\n"); + printf("Only can be ran on the service node of a Bluegene system.\n"); return 0; } diff --git a/src/plugins/select/bluegene/sfree.h b/src/plugins/select/bluegene/plugin/sfree.h similarity index 97% rename from src/plugins/select/bluegene/sfree.h rename to src/plugins/select/bluegene/plugin/sfree.h index 8b830d46d5d5349fae8999d5b9cbf826b6e22d77..15f53c7302fc520d6795e1eb595e7a08f0357fc9 100644 --- a/src/plugins/select/bluegene/sfree.h +++ b/src/plugins/select/bluegene/plugin/sfree.h @@ -43,8 +43,8 @@ typedef void (*sighandler_t) (int); -extern char *bgl_part_id; -extern int all_parts; +extern char *bg_block_id; +extern int all_blocks; extern void parse_command_line(int argc, char *argv[]); diff --git a/src/plugins/select/bluegene/slurm_epilog.c b/src/plugins/select/bluegene/plugin/slurm_epilog.c similarity index 97% rename from src/plugins/select/bluegene/slurm_epilog.c rename to src/plugins/select/bluegene/plugin/slurm_epilog.c index a0b13c1b6b731c5fb5ecb98816d68562fac65358..91ae7f27fcc54f0bcd1528ae595daf6bf6dd1d8e 100644 --- a/src/plugins/select/bluegene/slurm_epilog.c +++ b/src/plugins/select/bluegene/plugin/slurm_epilog.c @@ -47,10 +47,10 @@ #define _DEBUG 0 /* - * Check the bglblock's status every POLL_SLEEP seconds. + * Check the bgblock's status every POLL_SLEEP seconds. * Retry for a period of MIN_DELAY + (INCR_DELAY * base partition count). * For example if MIN_DELAY=300 and INCR_DELAY=20, wait up to 428 seconds - * for a 16 base partition bglblock to ready (300 + 20 * 16). + * for a 16 base partition bgblock to ready (300 + 20 * 16). */ #define POLL_SLEEP 3 /* retry interval in seconds */ #define MIN_DELAY 300 /* time in seconds */ diff --git a/src/plugins/select/bluegene/slurm_prolog.c b/src/plugins/select/bluegene/plugin/slurm_prolog.c similarity index 89% rename from src/plugins/select/bluegene/slurm_prolog.c rename to src/plugins/select/bluegene/plugin/slurm_prolog.c index ffaa4b32b24673597a50fb9c273a155a887840fe..7229335837ce257da37ed4036affa7e4e054af37 100644 --- a/src/plugins/select/bluegene/slurm_prolog.c +++ b/src/plugins/select/bluegene/plugin/slurm_prolog.c @@ -49,12 +49,12 @@ #define _DEBUG 0 /* - * Check the bglblock's status every POLL_SLEEP seconds. + * Check the bgblock's status every POLL_SLEEP seconds. * Retry for a period of MIN_DELAY + * (INCR_DELAY * POLL_SLEEP * base partition count). * For example if MIN_DELAY=300 and INCR_DELAY=20 and POLL_SLEEP=3, * wait up to 1260 seconds. - * For a 16 base partition bglblock to be ready (300 + (20 * 3 * 16). + * For a 16 base partition bgblock to be ready (300 + (20 * 3 * 16). */ #define POLL_SLEEP 3 /* retry interval in seconds */ #define MIN_DELAY 300 /* time in seconds */ @@ -175,27 +175,27 @@ static int _get_job_size(uint32_t job_id) } /* - * Test if any BGL blocks are in deallocating state + * Test if any BG blocks are in deallocating state * RET 1: deallocate in progress * 0: no deallocate in progress * -1: error occurred */ static int _partitions_dealloc() { - static node_select_info_msg_t *bgl_info_ptr = NULL, *new_bgl_ptr = NULL; + static node_select_info_msg_t *bg_info_ptr = NULL, *new_bg_ptr = NULL; int rc = 0, error_code = 0, i; - if (bgl_info_ptr) { - error_code = slurm_load_node_select(bgl_info_ptr->last_update, - &new_bgl_ptr); + if (bg_info_ptr) { + error_code = slurm_load_node_select(bg_info_ptr->last_update, + &new_bg_ptr); if (error_code == SLURM_SUCCESS) - select_g_free_node_info(&bgl_info_ptr); + select_g_free_node_info(&bg_info_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; - new_bgl_ptr = bgl_info_ptr; + new_bg_ptr = bg_info_ptr; } } else { - error_code = slurm_load_node_select((time_t) NULL, &new_bgl_ptr); + error_code = slurm_load_node_select((time_t) NULL, &new_bg_ptr); } if (error_code) { @@ -203,13 +203,13 @@ static int _partitions_dealloc() slurm_strerror(slurm_get_errno())); return -1; } - for (i=0; i<new_bgl_ptr->record_count; i++) { - if(new_bgl_ptr->bgl_info_array[i].state + for (i=0; i<new_bg_ptr->record_count; i++) { + if(new_bg_ptr->bg_info_array[i].state == RM_PARTITION_DEALLOCATING) { rc = 1; break; } } - bgl_info_ptr = new_bgl_ptr; + bg_info_ptr = new_bg_ptr; return rc; } diff --git a/src/plugins/select/bluegene/state_test.c b/src/plugins/select/bluegene/plugin/state_test.c similarity index 71% rename from src/plugins/select/bluegene/state_test.c rename to src/plugins/select/bluegene/plugin/state_test.c index eef3e9cb85e4b51256a4a592f8c45fae430ed4b0..98a5c7cbac8472b3819fc2a8660189a21ef3643d 100644 --- a/src/plugins/select/bluegene/state_test.c +++ b/src/plugins/select/bluegene/plugin/state_test.c @@ -41,7 +41,7 @@ #define BUFSIZE 4096 -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES /* Determine if specific slurm node is already in DOWN or DRAIN state */ extern bool node_already_down(char *node_name) @@ -63,41 +63,41 @@ extern bool node_already_down(char *node_name) } /* Find the specified BlueGene node ID and drain it from SLURM */ -static void _configure_node_down(rm_bp_id_t bp_id, rm_BGL_t *bgl) +static void _configure_node_down(rm_bp_id_t bp_id, rm_BGL_t *bg) { int bp_num, i, rc; rm_bp_id_t bpid; rm_BP_t *my_bp; rm_location_t bp_loc; rm_BP_state_t bp_state; - char bgl_down_node[128], reason[128]; + char bg_down_node[128], reason[128]; time_t now = time(NULL); struct tm *time_ptr = localtime(&now); - if ((rc = rm_get_data(bgl, RM_BPNum, &bp_num)) != STATUS_OK) { - error("rm_get_data(RM_BPNum): %s", bgl_err_str(rc)); + if ((rc = rm_get_data(bg, RM_BPNum, &bp_num)) != STATUS_OK) { + error("rm_get_data(RM_BPNum): %s", bg_err_str(rc)); bp_num = 0; } for (i=0; i<bp_num; i++) { if (i) { - if ((rc = rm_get_data(bgl, RM_NextBP, &my_bp)) != + if ((rc = rm_get_data(bg, RM_NextBP, &my_bp)) != STATUS_OK) { error("rm_get_data(RM_NextBP): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } } else { - if ((rc = rm_get_data(bgl, RM_FirstBP, &my_bp)) != + if ((rc = rm_get_data(bg, RM_FirstBP, &my_bp)) != STATUS_OK) { error("rm_get_data(RM_FirstBP): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } } if ((rc = rm_get_data(my_bp, RM_BPID, &bpid)) != STATUS_OK) { - error("rm_get_data(RM_BPID): %s", bgl_err_str(rc)); + error("rm_get_data(RM_BPID): %s", bg_err_str(rc)); continue; } @@ -114,7 +114,7 @@ static void _configure_node_down(rm_bp_id_t bp_id, rm_BGL_t *bgl) if ((rc = rm_get_data(my_bp, RM_BPState, &bp_state)) != STATUS_OK) { - error("rm_get_data(RM_BPState): %s", bgl_err_str(rc)); + error("rm_get_data(RM_BPState): %s", bg_err_str(rc)); continue; } if (bp_state != RM_BP_UP) /* already down */ @@ -122,20 +122,20 @@ static void _configure_node_down(rm_bp_id_t bp_id, rm_BGL_t *bgl) if ((rc = rm_get_data(my_bp, RM_BPLoc, &bp_loc)) != STATUS_OK) { - error("rm_get_data(RM_BPLoc): %s", bgl_err_str(rc)); + error("rm_get_data(RM_BPLoc): %s", bg_err_str(rc)); continue; } - snprintf(bgl_down_node, sizeof(bgl_down_node), "bgl%d%d%d", + snprintf(bg_down_node, sizeof(bg_down_node), "bg%d%d%d", bp_loc.X, bp_loc.Y, bp_loc.Z); - if (node_already_down(bgl_down_node)) + if (node_already_down(bg_down_node)) break; - error("switch for node %s is bad", bgl_down_node); + error("switch for node %s is bad", bg_down_node); strftime(reason, sizeof(reason), "select_bluegene: MMCS switch not UP " "[SLURM@%b %d %H:%M]", time_ptr); - slurm_drain_nodes(bgl_down_node, reason); + slurm_drain_nodes(bg_down_node, reason); break; } } @@ -163,44 +163,44 @@ static char *_convert_bp_state(rm_BP_state_t state) } /* Test for nodes that are not UP in MMCS and DRAIN them in SLURM */ -static void _test_down_nodes(rm_BGL_t *bgl) +static void _test_down_nodes(rm_BGL_t *bg) { int bp_num, i, rc; rm_BP_t *my_bp; rm_BP_state_t bp_state; rm_location_t bp_loc; char down_node_list[BUFSIZE]; - char bgl_down_node[128]; + char bg_down_node[128]; char reason[128]; time_t now = time(NULL); struct tm * time_ptr = localtime(&now); debug2("Running _test_down_nodes"); down_node_list[0] = '\0'; - if ((rc = rm_get_data(bgl, RM_BPNum, &bp_num)) != STATUS_OK) { - error("rm_get_data(RM_BPNum): %s", bgl_err_str(rc)); + if ((rc = rm_get_data(bg, RM_BPNum, &bp_num)) != STATUS_OK) { + error("rm_get_data(RM_BPNum): %s", bg_err_str(rc)); bp_num = 0; } for (i=0; i<bp_num; i++) { if (i) { - if ((rc = rm_get_data(bgl, RM_NextBP, &my_bp)) + if ((rc = rm_get_data(bg, RM_NextBP, &my_bp)) != STATUS_OK) { error("rm_get_data(RM_NextBP): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } } else { - if ((rc = rm_get_data(bgl, RM_FirstBP, &my_bp)) + if ((rc = rm_get_data(bg, RM_FirstBP, &my_bp)) != STATUS_OK) { error("rm_get_data(RM_FirstBP): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } } if ((rc = rm_get_data(my_bp, RM_BPState, &bp_state)) != STATUS_OK) { - error("rm_get_data(RM_BPState): %s", bgl_err_str(rc)); + error("rm_get_data(RM_BPState): %s", bg_err_str(rc)); continue; } @@ -209,25 +209,25 @@ static void _test_down_nodes(rm_BGL_t *bgl) if ((rc = rm_get_data(my_bp, RM_BPLoc, &bp_loc)) != STATUS_OK) { - error("rm_get_data(RM_BPLoc): %s", bgl_err_str(rc)); + error("rm_get_data(RM_BPLoc): %s", bg_err_str(rc)); continue; } - snprintf(bgl_down_node, sizeof(bgl_down_node), "bgl%d%d%d", + snprintf(bg_down_node, sizeof(bg_down_node), "bg%d%d%d", bp_loc.X, bp_loc.Y, bp_loc.Z); - if (node_already_down(bgl_down_node)) + if (node_already_down(bg_down_node)) continue; debug("_test_down_nodes: %s in state %s", - bgl_down_node, _convert_bp_state(RM_BPState)); + bg_down_node, _convert_bp_state(RM_BPState)); - if ((strlen(down_node_list) + strlen(bgl_down_node) + if ((strlen(down_node_list) + strlen(bg_down_node) + 2) < BUFSIZE) { if (down_node_list[0] != '\0') strcat(down_node_list,","); - strcat(down_node_list, bgl_down_node); + strcat(down_node_list, bg_down_node); } else error("down_node_list overflow"); } @@ -243,7 +243,7 @@ static void _test_down_nodes(rm_BGL_t *bgl) /* Test for switches that are not UP in MMCS, * when found DRAIN them in SLURM and configure their base partition DOWN */ -static void _test_down_switches(rm_BGL_t *bgl) +static void _test_down_switches(rm_BGL_t *bg) { int switch_num, i, rc; rm_switch_t *my_switch; @@ -251,23 +251,23 @@ static void _test_down_switches(rm_BGL_t *bgl) rm_switch_state_t switch_state; debug2("Running _test_down_switches"); - if ((rc = rm_get_data(bgl, RM_SwitchNum, &switch_num)) != STATUS_OK) { - error("rm_get_data(RM_SwitchNum): %s", bgl_err_str(rc)); + if ((rc = rm_get_data(bg, RM_SwitchNum, &switch_num)) != STATUS_OK) { + error("rm_get_data(RM_SwitchNum): %s", bg_err_str(rc)); switch_num = 0; } for (i=0; i<switch_num; i++) { if (i) { - if ((rc = rm_get_data(bgl, RM_NextSwitch, &my_switch)) + if ((rc = rm_get_data(bg, RM_NextSwitch, &my_switch)) != STATUS_OK) { error("rm_get_data(RM_NextSwitch): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } } else { - if ((rc = rm_get_data(bgl, RM_FirstSwitch, &my_switch)) + if ((rc = rm_get_data(bg, RM_FirstSwitch, &my_switch)) != STATUS_OK) { error("rm_get_data(RM_FirstSwitch): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } } @@ -275,7 +275,7 @@ static void _test_down_switches(rm_BGL_t *bgl) if ((rc = rm_get_data(my_switch, RM_SwitchState, &switch_state)) != STATUS_OK) { error("rm_get_data(RM_SwitchState): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } if (switch_state == RM_SWITCH_UP) @@ -283,7 +283,7 @@ static void _test_down_switches(rm_BGL_t *bgl) if ((rc = rm_get_data(my_switch, RM_SwitchBPID, &bp_id)) != STATUS_OK) { error("rm_get_data(RM_SwitchBPID): %s", - bgl_err_str(rc)); + bg_err_str(rc)); continue; } @@ -292,7 +292,7 @@ static void _test_down_switches(rm_BGL_t *bgl) continue; } - _configure_node_down(bp_id, bgl); + _configure_node_down(bp_id, bg); free(bp_id); } } @@ -300,28 +300,28 @@ static void _test_down_switches(rm_BGL_t *bgl) /* * Search MMCS for failed switches and nodes. Failed resources are DRAINED in - * SLURM. This relies upon rm_get_BGL(), which is slow (10+ seconds) so run + * SLURM. This relies upon rm_get_BG(), which is slow (10+ seconds) so run * this test infrequently. */ extern void test_mmcs_failures(void) { -#ifdef HAVE_BGL_FILES - rm_BGL_t *bgl; +#ifdef HAVE_BG_FILES + rm_BGL_t *bg; int rc; - if ((rc = rm_set_serial(BGL_SERIAL)) != STATUS_OK) { - error("rm_set_serial(%s): %s", BGL_SERIAL, bgl_err_str(rc)); + if ((rc = rm_set_serial(BG_SERIAL)) != STATUS_OK) { + error("rm_set_serial(%s): %s", BG_SERIAL, bg_err_str(rc)); return; } - if ((rc = rm_get_BGL(&bgl)) != STATUS_OK) { - error("rm_get_BGL(): %s", bgl_err_str(rc)); + if ((rc = rm_get_BGL(&bg)) != STATUS_OK) { + error("rm_get_BGL(): %s", bg_err_str(rc)); return; } - _test_down_switches(bgl); - _test_down_nodes(bgl); - if ((rc = rm_free_BGL(bgl)) != STATUS_OK) - error("rm_free_BGL(): %s", bgl_err_str(rc)); + _test_down_switches(bg); + _test_down_nodes(bg); + if ((rc = rm_free_BGL(bg)) != STATUS_OK) + error("rm_free_BGL(): %s", bg_err_str(rc)); #endif } diff --git a/src/plugins/select/bluegene/state_test.h b/src/plugins/select/bluegene/plugin/state_test.h similarity index 100% rename from src/plugins/select/bluegene/state_test.h rename to src/plugins/select/bluegene/plugin/state_test.h diff --git a/src/plugins/select/bluegene/wrap_rm_api.h b/src/plugins/select/bluegene/wrap_rm_api.h index 1338bae609fd4cac3e73f4bc2485199418b99c15..e882f12819c1589e7098523e0df61a2f4fb7dacd 100644 --- a/src/plugins/select/bluegene/wrap_rm_api.h +++ b/src/plugins/select/bluegene/wrap_rm_api.h @@ -7,8 +7,8 @@ # include "config.h" #endif -#ifdef HAVE_BGL_FILES - /* Over-ride attach_bgl.h inclusion due to problems in compiling it +#ifdef HAVE_BG_FILES + /* Over-ride attach_bg.h inclusion due to problems in compiling it * with gcc and missing externals in that file */ /* MPI Debug support */ @@ -19,7 +19,7 @@ int pid; /* The pid of the process */ } MPIR_PROCDESC; -# include "rm_api.h" +#include "rm_api.h" #else typedef char * pm_partition_id_t; @@ -33,7 +33,7 @@ typedef int rm_BP_state_t; /* these are the typedefs that we will need to have - * if we want the states on the Front End Node of a BGL system + * if we want the states on the Front End Node of a BG system * make certain they match the rm_api.h values on the Service Node */ enum rm_partition_state {RM_PARTITION_FREE, RM_PARTITION_CONFIGURING, diff --git a/src/plugins/select/cons_res/select_cons_res.c b/src/plugins/select/cons_res/select_cons_res.c index a0e9aa8a7ab16710b21037cf9a0bf5a601759b1b..878f502d8a31b601e8844b0447e9c1c7f8e52e9c 100644 --- a/src/plugins/select/cons_res/select_cons_res.c +++ b/src/plugins/select/cons_res/select_cons_res.c @@ -484,7 +484,7 @@ extern int select_p_node_init(struct node_record *node_ptr, int node_cnt) return SLURM_SUCCESS; } -extern int select_p_part_init(List part_list) +extern int select_p_block_init(List part_list) { return SLURM_SUCCESS; } diff --git a/src/plugins/select/linear/select_linear.c b/src/plugins/select/linear/select_linear.c index 09409d5e8028a191e52d0753414f8d86ec068f7c..b0c843d9bf19cb7b8e736d921a0dcb07cb3cf1d0 100644 --- a/src/plugins/select/linear/select_linear.c +++ b/src/plugins/select/linear/select_linear.c @@ -154,7 +154,7 @@ extern int select_p_node_init(struct node_record *node_ptr, int node_cnt) return SLURM_SUCCESS; } -extern int select_p_part_init(List part_list) +extern int select_p_block_init(List part_list) { return SLURM_SUCCESS; } diff --git a/src/sinfo/Makefile.am b/src/sinfo/Makefile.am index 69f3fdd03dec478fdda063686475a703c2575f57..7b536988c843f4b899f23c3ce8142d1dfb39ec84 100644 --- a/src/sinfo/Makefile.am +++ b/src/sinfo/Makefile.am @@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = foreign -INCLUDES = -I$(top_srcdir) $(BGL_INCLUDES) +INCLUDES = -I$(top_srcdir) $(BG_INCLUDES) bin_PROGRAMS = sinfo sinfo_LDADD = \ diff --git a/src/sinfo/opts.c b/src/sinfo/opts.c index 7672df25ee87a1df1e68cd79131210fd384c9600..c95fe9b436b982c560109ecf71df2bd65134d890 100644 --- a/src/sinfo/opts.c +++ b/src/sinfo/opts.c @@ -75,7 +75,7 @@ extern void parse_command_line(int argc, char *argv[]) int option_index; static struct option long_options[] = { {"all", no_argument, 0, 'a'}, - {"bgl", no_argument, 0, 'b'}, + {"bg", no_argument, 0, 'b'}, {"dead", no_argument, 0, 'd'}, {"exact", no_argument, 0, 'e'}, {"noheader", no_argument, 0, 'h'}, @@ -117,10 +117,10 @@ extern void parse_command_line(int argc, char *argv[]) params.all_flag = true; break; case (int)'b': -#ifdef HAVE_BGL - params.bgl_flag = true; +#ifdef HAVE_BG + params.bg_flag = true; #else - error("must be on a BGL system to use --bgl option"); + error("must be on a BG system to use --bg option"); exit(1); #endif break; @@ -613,7 +613,7 @@ void _print_options( void ) printf("all_flag = %s\n", params.all_flag ? "true" : "false"); printf("avail_flag = %s\n", params.match_flags.avail_flag ? "true" : "false"); - printf("bgl_flag = %s\n", params.bgl_flag ? "true" : "false"); + printf("bg_flag = %s\n", params.bg_flag ? "true" : "false"); printf("cpus_flag = %s\n", params.match_flags.cpus_flag ? "true" : "false"); printf("disk_flag = %s\n", params.match_flags.disk_flag ? @@ -662,7 +662,7 @@ static void _help( void ) Usage: sinfo [OPTIONS]\n\ -a, --all show all partitions (including hidden and those\n\ not accessible)\n\ - -b, --bgl show bglblocks (on Blue Gene systems)\n\ + -b, --bg show bgblocks (on Blue Gene systems)\n\ -d, --dead show only non-responding nodes\n\ -e, --exact group nodes only on exact match of configuration\n\ -h, --noheader no headers on output\n\ diff --git a/src/sinfo/sinfo.c b/src/sinfo/sinfo.c index af1930322dd18ccbc3cab5bbffaf4144dc7623c6..7770e1ff0f3b41dc2f7b9241be2d6dfc7b0e5619 100644 --- a/src/sinfo/sinfo.c +++ b/src/sinfo/sinfo.c @@ -37,7 +37,7 @@ #include "src/sinfo/sinfo.h" #include "src/sinfo/print.h" -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES # include "src/plugins/select/bluegene/wrap_rm_api.h" #endif @@ -49,7 +49,7 @@ struct sinfo_parameters params; /************ * Funtions * ************/ -static int _bgl_report(void); +static int _bg_report(void); static int _build_sinfo_data(List sinfo_list, partition_info_msg_t *partition_msg, node_info_msg_t *node_msg); @@ -83,8 +83,8 @@ int main(int argc, char *argv[]) && (params.iterate || params.verbose || params.long_output)) print_date(); - if (params.bgl_flag) - (void) _bgl_report(); + if (params.bg_flag) + (void) _bg_report(); else { if (_query_server(&partition_msg, &node_msg) != 0) exit(1); @@ -132,7 +132,7 @@ static char *_part_state_str(int state) { static char tmp[16]; -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES switch (state) { case RM_PARTITION_BUSY: return "BUSY"; @@ -154,25 +154,25 @@ static char *_part_state_str(int state) } /* - * _bgl_report - download and print current bglblock state information + * _bg_report - download and print current bgblock state information */ -static int _bgl_report(void) +static int _bg_report(void) { - static node_select_info_msg_t *old_bgl_ptr = NULL, *new_bgl_ptr; + static node_select_info_msg_t *old_bg_ptr = NULL, *new_bg_ptr; int error_code, i; - if (old_bgl_ptr) { - error_code = slurm_load_node_select(old_bgl_ptr->last_update, - &new_bgl_ptr); + if (old_bg_ptr) { + error_code = slurm_load_node_select(old_bg_ptr->last_update, + &new_bg_ptr); if (error_code == SLURM_SUCCESS) - select_g_free_node_info(&new_bgl_ptr); + select_g_free_node_info(&new_bg_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; - new_bgl_ptr = old_bgl_ptr; + new_bg_ptr = old_bg_ptr; } } else { error_code = slurm_load_node_select((time_t) NULL, - &new_bgl_ptr); + &new_bg_ptr); } if (error_code) { slurm_perror("slurm_load_node_select"); @@ -180,18 +180,18 @@ static int _bgl_report(void) } if (!params.no_header) - printf("BGL_BLOCK NODES OWNER STATE CONNECTION USE\n"); + printf("BG_BLOCK NODES OWNER STATE CONNECTION USE\n"); /* 1234567890123456 123456789012 12345678 12345678 1234567890 12345+ */ -/* RMP_22Apr1544018 bgl[123x456] name READY TORUS COPROCESSOR */ +/* RMP_22Apr1544018 bg[123x456] name READY TORUS COPROCESSOR */ - for (i=0; i<new_bgl_ptr->record_count; i++) { + for (i=0; i<new_bg_ptr->record_count; i++) { printf("%-16.16s %-12.12s %-8.8s %-8.8s %-10.10s %s\n", - new_bgl_ptr->bgl_info_array[i].bgl_part_id, - new_bgl_ptr->bgl_info_array[i].nodes, - new_bgl_ptr->bgl_info_array[i].owner_name, - _part_state_str(new_bgl_ptr->bgl_info_array[i].state), - _conn_type_str(new_bgl_ptr->bgl_info_array[i].conn_type), - _node_use_str(new_bgl_ptr->bgl_info_array[i].node_use)); + new_bg_ptr->bg_info_array[i].bg_block_id, + new_bg_ptr->bg_info_array[i].nodes, + new_bg_ptr->bg_info_array[i].owner_name, + _part_state_str(new_bg_ptr->bg_info_array[i].state), + _conn_type_str(new_bg_ptr->bg_info_array[i].conn_type), + _node_use_str(new_bg_ptr->bg_info_array[i].node_use)); } return SLURM_SUCCESS; diff --git a/src/sinfo/sinfo.h b/src/sinfo/sinfo.h index f0f8a80ada974ba60c3bfe29c81b7cee63baabff..d72658cdeb629f76595423a51215fedc776bf9ed 100644 --- a/src/sinfo/sinfo.h +++ b/src/sinfo/sinfo.h @@ -107,7 +107,7 @@ struct sinfo_match_flags { /* Input parameters */ struct sinfo_parameters { bool all_flag; - bool bgl_flag; + bool bg_flag; bool dead_nodes; bool exact_match; bool filtering; diff --git a/src/slurmctld/Makefile.am b/src/slurmctld/Makefile.am index 3d1c9ee6df708f350a649478a640e43212aa3ce0..ba28a3e371cb375501cf799b00ff2b33e312671b 100644 --- a/src/slurmctld/Makefile.am +++ b/src/slurmctld/Makefile.am @@ -42,7 +42,7 @@ slurmctld_SOURCES = \ state_save.h \ step_mgr.c -slurmctld_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) $(BGL_LDFLAGS) \ +slurmctld_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) $(BG_LDFLAGS) \ $(FEDERATION_LDFLAGS) force: diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c index 8746b88b452755f68661caff0fb0fc456fc59d73..70f0a9aa330eeeea497d4f1645644f02c27cc038 100644 --- a/src/slurmctld/controller.c +++ b/src/slurmctld/controller.c @@ -108,7 +108,7 @@ log_options_t log_opts = LOG_OPTS_INITIALIZER; /* Global variables */ slurm_ctl_conf_t slurmctld_conf; slurmctld_config_t slurmctld_config; -int bgl_recover = DEFAULT_RECOVER; +int bg_recover = DEFAULT_RECOVER; /* Local variables */ static int daemonize = DEFAULT_DAEMONIZE; @@ -913,7 +913,7 @@ static void _parse_commandline(int argc, char *argv[], switch (c) { case 'c': recover = 0; - bgl_recover = 0; + bg_recover = 0; break; case 'd': daemonize = 1; @@ -933,7 +933,7 @@ static void _parse_commandline(int argc, char *argv[], break; case 'r': recover = 1; - bgl_recover = 1; + bg_recover = 1; break; case 'v': debug_level++; diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index e96637c464725f124b22f3288eefc0c41f8edc58..adc9d941627079f30c7e9630718c5dc218980a93 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -3299,7 +3299,7 @@ int update_job(job_desc_msg_t * job_specs, uid_t uid) } #endif -#ifdef HAVE_BGL +#ifdef HAVE_BG if (job_specs->conn_type != (uint16_t) NO_VAL) { select_g_set_jobinfo(job_ptr->select_jobinfo, SELECT_DATA_CONN_TYPE, diff --git a/src/slurmctld/job_scheduler.c b/src/slurmctld/job_scheduler.c index 662180e244ef6d3dbba13565ceb85a30ed4117b0..9961ddfc4dc9d90f2654221672de55ece203f98e 100644 --- a/src/slurmctld/job_scheduler.c +++ b/src/slurmctld/job_scheduler.c @@ -178,7 +178,7 @@ int schedule(void) continue; error_code = select_nodes(job_ptr, false); if (error_code == ESLURM_NODES_BUSY) { -#ifndef HAVE_BGL /* keep trying to schedule jobs in partition */ +#ifndef HAVE_BG /* keep trying to schedule jobs in partition */ /* While we use static partitiioning on Blue Gene, * each job can be scheduled independently without * impacting other jobs with different characteristics diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c index 6c9481fdc147bc56f95fd67add4f6b16c17a0ece..31b11b56901fb9b3e6e45ba068b83c8c2edcc0da 100644 --- a/src/slurmctld/node_mgr.c +++ b/src/slurmctld/node_mgr.c @@ -1259,9 +1259,9 @@ extern int validate_nodes_via_front_end(uint32_t job_count, while ((job_ptr = (struct job_record *) list_next(job_iterator))) { if ((job_ptr->job_state != JOB_RUNNING) || (job_ptr->batch_flag == 0) || -#ifdef HAVE_BGL +#ifdef HAVE_BG /* slurmd does not report job presence until after prolog - * completes which waits for bglblock boot to complete. + * completes which waits for bgblock boot to complete. * This can take several minutes on BlueGene. */ (difftime(now, job_ptr->time_last_active) <= (1400 + 5 * job_ptr->node_cnt))) diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c index ef19cfd929f2afc64e2411485c3d22e325f17961..4dbe186a905610e1f2ccf5ba4eedd0194eb399fb 100644 --- a/src/slurmctld/node_scheduler.c +++ b/src/slurmctld/node_scheduler.c @@ -400,7 +400,7 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, bool runable_ever = false; /* Job can ever run */ bool runable_avail = false; /* Job can run with available nodes */ int cr_enabled = 0; -#ifdef HAVE_BGL +#ifdef HAVE_BG uint16_t checked = 0; #endif if (node_set_size == 0) { @@ -545,20 +545,21 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, } bit_and(node_set_ptr[i].my_bitmap, avail_node_bitmap); if (shared) { -#ifdef HAVE_BGL +#ifdef HAVE_BG /* Exclude nodes which have jobs in COMPLETING * state in order to insure Epilog completes * before possibly scheduling another job to - * the same bglblock. */ + * the same bgblock. */ int ni; bit_and(node_set_ptr[i].my_bitmap, share_node_bitmap); for (ni = 0; ni < node_record_count; ni++) { - if (node_record_table_ptr[ni].node_state - & NODE_STATE_COMPLETING) - bit_clear(node_set_ptr[i].my_bitmap, ni); + if (node_record_table_ptr[ni]. + node_state + & NODE_STATE_COMPLETING) + bit_clear(node_set_ptr[i]. + my_bitmap, ni); } - /* pick_light_load = false; Non-overlapping blocks */ #else bit_and(node_set_ptr[i].my_bitmap, share_node_bitmap); @@ -599,12 +600,12 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, avail_bitmap, min_nodes, max_nodes); - } else + } else pick_code = select_g_job_test(job_ptr, avail_bitmap, min_nodes, max_nodes); - + if (pick_code == SLURM_SUCCESS) { if ((node_lim != INFINITE) && (bit_set_count(avail_bitmap) > node_lim)) { @@ -700,7 +701,7 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, error_code = ESLURM_REQUESTED_NODE_CONFIG_UNAVAILABLE; info("_pick_best_nodes: job never runnable"); } -#ifdef HAVE_BGL +#ifdef HAVE_BG select_g_set_jobinfo(job_ptr->select_jobinfo, SELECT_DATA_CHECKED, &checked); #endif diff --git a/src/slurmctld/partition_mgr.c b/src/slurmctld/partition_mgr.c index c9680a5baf715eb389a97bc76567ab57f06c2455..a8526da55073d03d93da4fd0ba41ae11cdc9989b 100644 --- a/src/slurmctld/partition_mgr.c +++ b/src/slurmctld/partition_mgr.c @@ -847,7 +847,7 @@ int update_part(update_part_msg_t * part_desc) if (error_code == SLURM_SUCCESS) { reset_job_priority(); /* free jobs */ - if (select_g_part_init(part_list) != SLURM_SUCCESS ) + if (select_g_block_init(part_list) != SLURM_SUCCESS ) error("failed to update node selection plugin state"); } diff --git a/src/slurmctld/read_config.c b/src/slurmctld/read_config.c index 7efa3389d15da4166c1b62d4a6c5f647b2b75c61..6169947405d3dce7719de4b8ee825c705eabde7a 100644 --- a/src/slurmctld/read_config.c +++ b/src/slurmctld/read_config.c @@ -889,7 +889,7 @@ int read_slurm_conf(int recover) #endif if ((select_g_node_init(node_record_table_ptr, node_record_count) != SLURM_SUCCESS) - || (select_g_part_init(part_list) != SLURM_SUCCESS) + || (select_g_block_init(part_list) != SLURM_SUCCESS) || (select_g_job_init(job_list) != SLURM_SUCCESS)) { error("failed to initialize node selection plugin state"); abort(); diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h index c4e7245067d13933d5e59fabc7d0395ed3f5285c..4bf3ec62195d710d2e00a3606a188d43883ccbf5 100644 --- a/src/slurmctld/slurmctld.h +++ b/src/slurmctld/slurmctld.h @@ -132,7 +132,7 @@ typedef struct slurmctld_config { extern slurmctld_config_t slurmctld_config; extern slurm_ctl_conf_t slurmctld_conf; -extern int bgl_recover; /* state recovery mode */ +extern int bg_recover; /* state recovery mode */ /*****************************************************************************\ * NODE parameters and data structures diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c index 7f49112d61aeb1eab15f1dcf8f88ec4022269d6f..47aee9840afe1cc6b90ae206fe80e6993a7e2ccf 100644 --- a/src/slurmctld/step_mgr.c +++ b/src/slurmctld/step_mgr.c @@ -390,7 +390,7 @@ _pick_step_nodes (struct job_record *job_ptr, if ( step_spec->node_count == INFINITE) /* use all nodes */ return nodes_avail; - +try_again: if (step_spec->node_list) { error_code = node_name2bitmap (step_spec->node_list, false, &nodes_picked); @@ -406,6 +406,16 @@ _pick_step_nodes (struct job_record *job_ptr, goto cleanup; } if(step_spec->task_dist == SLURM_DIST_HOSTFILE) { + if (!strcmp(slurmctld_conf.switch_type, + "switch/elan")) { + error("Can't do a HOSTFILE with switch " + "type elan. Switching DIST type to " + "BLOCK"); + xfree(step_spec->node_list); + step_spec->task_dist == SLURM_DIST_BLOCK; + FREE_NULL_BITMAP(nodes_picked); + goto try_again; + } FREE_NULL_BITMAP(nodes_avail); return nodes_picked; } @@ -416,8 +426,9 @@ _pick_step_nodes (struct job_record *job_ptr, relative_nodes = bit_pick_cnt (nodes_avail, step_spec->relative); if (relative_nodes == NULL) { - info ("_pick_step_nodes: Invalid relative value (%u) for job %u", - step_spec->relative, job_ptr->job_id); + info ("_pick_step_nodes: " + "Invalid relative value (%u) for job %u", + step_spec->relative, job_ptr->job_id); goto cleanup; } bit_not (relative_nodes); @@ -557,7 +568,10 @@ step_create ( job_step_create_request_msg_t *step_specs, /* set the step_record values */ /* Here is where the node list is set for the job */ - step_ptr->step_node_list = xstrdup(step_specs->node_list); + if(step_specs->node_list) + step_ptr->step_node_list = xstrdup(step_specs->node_list); + else + step_ptr->step_node_list = bitmap2node_name(nodeset); xfree(step_specs->node_list); step_specs->node_list = bitmap2node_name(nodeset); step_ptr->step_node_bitmap = nodeset; diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c index d6cf24a7458ec65f3a8b57a4a34c0d3bd306cc1f..b19d0e56ea7b7ee6311cc6e11f5e1fb1dad1aec5 100644 --- a/src/slurmd/slurmd/req.c +++ b/src/slurmd/slurmd/req.c @@ -67,7 +67,7 @@ static int _abort_job(uint32_t job_id); -static char ** _build_env(uint32_t jobid, uid_t uid, char *bgl_part_id); +static char ** _build_env(uint32_t jobid, uid_t uid, char *bg_part_id); static bool _slurm_authorized_user(uid_t uid); static bool _job_still_running(uint32_t job_id); static int _kill_all_active_steps(void *auth_cred, uint32_t jobid, @@ -86,8 +86,8 @@ static void _rpc_shutdown(slurm_msg_t *msg, slurm_addr *cli_addr); static void _rpc_reconfig(slurm_msg_t *msg, slurm_addr *cli_addr); static void _rpc_pid2jid(slurm_msg_t *msg, slurm_addr *); static int _rpc_ping(slurm_msg_t *, slurm_addr *); -static int _run_prolog(uint32_t jobid, uid_t uid, char *bgl_part_id); -static int _run_epilog(uint32_t jobid, uid_t uid, char *bgl_part_id); +static int _run_prolog(uint32_t jobid, uid_t uid, char *bg_part_id); +static int _run_epilog(uint32_t jobid, uid_t uid, char *bg_part_id); static bool _pause_for_job_completion(void *auth_cred, uint32_t jobid, int maxtime); @@ -696,7 +696,7 @@ _rpc_batch_job(slurm_msg_t *msg, slurm_addr *cli) bool first_job_run = true; int rc = SLURM_SUCCESS; uid_t req_uid = g_slurm_auth_get_uid(msg->cred); - char *bgl_part_id = NULL; + char *bg_part_id = NULL; bool replied = false; if (!_slurm_authorized_user(req_uid)) { @@ -719,10 +719,11 @@ _rpc_batch_job(slurm_msg_t *msg, slurm_addr *cli) /* * Run job prolog on this node */ - select_g_get_jobinfo(req->select_jobinfo, SELECT_DATA_PART_ID, - &bgl_part_id); + select_g_get_jobinfo(req->select_jobinfo, + SELECT_DATA_BLOCK_ID, + &bg_part_id); -#ifdef HAVE_BGL +#ifdef HAVE_BG /* BlueGene prolog waits for partition boot and is very slow. * Just reply now and send a separate kill job request if the * prolog or launch fail. */ @@ -730,8 +731,8 @@ _rpc_batch_job(slurm_msg_t *msg, slurm_addr *cli) replied = true; #endif - rc = _run_prolog(req->job_id, req->uid, bgl_part_id); - xfree(bgl_part_id); + rc = _run_prolog(req->job_id, req->uid, bg_part_id); + xfree(bg_part_id); if (rc != 0) { error("[job %u] prolog failed", req->job_id); _prolog_error(req, rc); @@ -1306,7 +1307,7 @@ _rpc_signal_job(slurm_msg_t *msg, slurm_addr *cli) uid_t uid = g_slurm_auth_get_uid(msg->cred); int nsteps = 0; int delay; - char *bgl_part_id = NULL; + char *bg_part_id = NULL; error("_rpc_signal_job not yet implemented"); /* @@ -1342,7 +1343,7 @@ _rpc_terminate_job(slurm_msg_t *msg, slurm_addr *cli) uid_t uid = g_slurm_auth_get_uid(msg->cred); int nsteps = 0; int delay; - char *bgl_part_id = NULL; + char *bg_part_id = NULL; debug("_rpc_terminate_job, uid = %d", uid); /* @@ -1442,10 +1443,10 @@ _rpc_terminate_job(slurm_msg_t *msg, slurm_addr *cli) } save_cred_state(conf->vctx); - select_g_get_jobinfo(req->select_jobinfo, SELECT_DATA_PART_ID, - &bgl_part_id); - rc = _run_epilog(req->job_id, req->job_uid, bgl_part_id); - xfree(bgl_part_id); + select_g_get_jobinfo(req->select_jobinfo, SELECT_DATA_BLOCK_ID, + &bg_part_id); + rc = _run_epilog(req->job_id, req->job_uid, bg_part_id); + xfree(bg_part_id); if (rc != 0) { error ("[job %u] epilog failed", req->job_id); rc = ESLURMD_EPILOG_FAILED; @@ -1571,25 +1572,25 @@ _rpc_update_time(slurm_msg_t *msg, slurm_addr *cli) /* NOTE: xfree returned value */ static char ** -_build_env(uint32_t jobid, uid_t uid, char *bgl_part_id) +_build_env(uint32_t jobid, uid_t uid, char *bg_part_id) { char **env = xmalloc(sizeof(char *)); env[0] = NULL; setenvf(&env, "SLURM_JOBID", "%u", jobid); setenvf(&env, "SLURM_UID", "%u", uid); - if (bgl_part_id) { + if (bg_part_id) { setenvf(&env, "MPIRUN_PARTITION", - "%s", bgl_part_id); + "%s", bg_part_id); } return env; } static int -_run_prolog(uint32_t jobid, uid_t uid, char *bgl_part_id) +_run_prolog(uint32_t jobid, uid_t uid, char *bg_part_id) { int error_code; char *my_prolog; - char **my_env = _build_env(jobid, uid, bgl_part_id); + char **my_env = _build_env(jobid, uid, bg_part_id); slurm_mutex_lock(&conf->config_mutex); my_prolog = xstrdup(conf->prolog); @@ -1604,11 +1605,11 @@ _run_prolog(uint32_t jobid, uid_t uid, char *bgl_part_id) } static int -_run_epilog(uint32_t jobid, uid_t uid, char *bgl_part_id) +_run_epilog(uint32_t jobid, uid_t uid, char *bg_part_id) { int error_code; char *my_epilog; - char **my_env = _build_env(jobid, uid, bgl_part_id); + char **my_env = _build_env(jobid, uid, bg_part_id); slurm_mutex_lock(&conf->config_mutex); my_epilog = xstrdup(conf->epilog); diff --git a/src/smap/Makefile.am b/src/smap/Makefile.am index 2d42391d7f9d15128a084f466cb537cde24c1bb9..bc59326669a1ea24ab4131c48389cf5884ba8750 100644 --- a/src/smap/Makefile.am +++ b/src/smap/Makefile.am @@ -8,14 +8,14 @@ AUTOMAKE_OPTIONS = foreign LIBS=$(NCURSES) -INCLUDES = -I$(top_srcdir) $(BGL_INCLUDES) +INCLUDES = -I$(top_srcdir) $(BG_INCLUDES) if HAVE_SOME_CURSES bin_PROGRAMS = smap smap_LDADD = \ - $(top_builddir)/src/partition_allocator/libpartition_allocator.la + $(top_builddir)/src/plugins/select/bluegene/block_allocator/libbluegene_block_allocator.la noinst_HEADERS = smap.h smap_SOURCES = smap.c \ @@ -26,7 +26,7 @@ force: $(smap_LDADD) : force @cd `dirname $@` && $(MAKE) `basename $@` -smap_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) $(BGL_LDFLAGS) +smap_LDFLAGS = -export-dynamic $(CMD_LDFLAGS) $(BG_LDFLAGS) else diff --git a/src/smap/configure_functions.c b/src/smap/configure_functions.c index 78f360ba37072b0ba953181f4cdbb1dfcdc736c6..73d9bdaa38d2ebe8b9a2961d3a67dcc428575758 100644 --- a/src/smap/configure_functions.c +++ b/src/smap/configure_functions.c @@ -33,45 +33,45 @@ typedef struct { int color; char letter; List nodes; - pa_request_t *request; -} allocated_part_t; + ba_request_t *request; +} allocated_block_t; -static void _delete_allocated_parts(List allocated_partitions); -static allocated_part_t *_make_request(pa_request_t *request); -static int _create_allocation(char *com, List allocated_partitions); +static void _delete_allocated_blocks(List allocated_blocks); +static allocated_block_t *_make_request(ba_request_t *request); +static int _create_allocation(char *com, List allocated_blocks); static int _resolve(char *com); static int _change_state_all_bps(char *com, int state); static int _change_state_bps(char *com, int state); -static int _remove_allocation(char *com, List allocated_partitions); -static int _alter_allocation(char *com, List allocated_partitions); -static int _copy_allocation(char *com, List allocated_partitions); -static int _save_allocation(char *com, List allocated_partitions); +static int _remove_allocation(char *com, List allocated_blocks); +static int _alter_allocation(char *com, List allocated_blocks); +static int _copy_allocation(char *com, List allocated_blocks); +static int _save_allocation(char *com, List allocated_blocks); static void _print_header_command(void); -static void _print_text_command(allocated_part_t *allocated_part); +static void _print_text_command(allocated_block_t *allocated_block); char error_string[255]; -static void _delete_allocated_parts(List allocated_partitions) +static void _delete_allocated_blocks(List allocated_blocks) { - allocated_part_t *allocated_part = NULL; + allocated_block_t *allocated_block = NULL; - while ((allocated_part = list_pop(allocated_partitions)) != NULL) { - remove_part(allocated_part->nodes,0); - list_destroy(allocated_part->nodes); - delete_pa_request(allocated_part->request); - xfree(allocated_part); + while ((allocated_block = list_pop(allocated_blocks)) != NULL) { + remove_block(allocated_block->nodes,0); + list_destroy(allocated_block->nodes); + delete_ba_request(allocated_block->request); + xfree(allocated_block); } - list_destroy(allocated_partitions); + list_destroy(allocated_blocks); } -static allocated_part_t *_make_request(pa_request_t *request) +static allocated_block_t *_make_request(ba_request_t *request) { List results = list_create(NULL); ListIterator results_i; - allocated_part_t *allocated_part = NULL; - pa_node_t *current = NULL; + allocated_block_t *allocated_block = NULL; + ba_node_t *current = NULL; - if (!allocate_part(request, results)){ + if (!allocate_block(request, results)){ memset(error_string,0,255); sprintf(error_string,"allocate failure for %dx%dx%d", request->geometry[0], request->geometry[1], @@ -79,30 +79,30 @@ static allocated_part_t *_make_request(pa_request_t *request) return NULL; } else { - allocated_part = (allocated_part_t *)xmalloc( - sizeof(allocated_part_t)); - allocated_part->request = request; - allocated_part->nodes = list_create(NULL); + allocated_block = (allocated_block_t *)xmalloc( + sizeof(allocated_block_t)); + allocated_block->request = request; + allocated_block->nodes = list_create(NULL); results_i = list_iterator_create(results); while ((current = list_next(results_i)) != NULL) { - list_append(allocated_part->nodes,current); - allocated_part->color = current->color; - allocated_part->letter = current->letter; + list_append(allocated_block->nodes,current); + allocated_block->color = current->color; + allocated_block->letter = current->letter; } list_iterator_destroy(results_i); } list_destroy(results); - return(allocated_part); + return(allocated_block); } -static int _create_allocation(char *com, List allocated_partitions) +static int _create_allocation(char *com, List allocated_blocks) { int i=6, geoi=-1, starti=-1, i2=0; int len = strlen(com); - allocated_part_t *allocated_part = NULL; - pa_request_t *request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); + allocated_block_t *allocated_block = NULL; + ba_request_t *request = (ba_request_t*) xmalloc(sizeof(ba_request_t)); request->geometry[0] = -1; request->conn_type=TORUS; @@ -209,7 +209,7 @@ static int _create_allocation(char *com, List allocated_partitions) It will send a request back which we will throw into a list just incase we change something later. */ - if(!new_pa_request(request)) { + if(!new_ba_request(request)) { memset(error_string,0,255); if(request->size!=-1) { sprintf(error_string, @@ -230,9 +230,9 @@ static int _create_allocation(char *com, List allocated_partitions) request->geometry[1], request->geometry[2]); } else { - if((allocated_part = _make_request(request)) != NULL) - list_append(allocated_partitions, - allocated_part); + if((allocated_block = _make_request(request)) != NULL) + list_append(allocated_blocks, + allocated_block); else { i2 = strlen(error_string); sprintf(error_string+i2, @@ -262,7 +262,7 @@ geo_error_message: static int _resolve(char *com) { int i=0; -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES int len=strlen(com); char *rack_mid = NULL; int *coord = NULL; @@ -274,9 +274,9 @@ static int _resolve(char *com) com[i] = 'R'; memset(error_string,0,255); -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES if (!have_db2) { - sprintf(error_string, "Must be on BGL SN to resolve\n"); + sprintf(error_string, "Must be on BG SN to resolve\n"); goto resolve_error; } @@ -301,7 +301,7 @@ static int _resolve(char *com) if(coord) sprintf(error_string, - "%s resolves to X=%d Y=%d Z=%d or bgl%d%d%d\n", + "%s resolves to X=%d Y=%d Z=%d or bg%d%d%d\n", com+i,coord[X],coord[Y],coord[Z], coord[X],coord[Y],coord[Z]); else @@ -311,9 +311,9 @@ static int _resolve(char *com) resolve_error: #else sprintf(error_string, - "Must be on BGL SN to resolve.\n"); + "Must be on BG SN to resolve.\n"); #endif - wnoutrefresh(pa_system_ptr->text_win); + wnoutrefresh(ba_system_ptr->text_win); doupdate(); return 1; @@ -323,7 +323,7 @@ static int _change_state_all_bps(char *com, int state) char allnodes[50]; memset(allnodes,0,50); -#ifdef HAVE_BGL +#ifdef HAVE_BG sprintf(allnodes, "[000x%d%d%d]", DIM_SIZE[X]-1, DIM_SIZE[Y]-1, DIM_SIZE[Z]-1); #else @@ -338,7 +338,7 @@ static int _change_state_bps(char *com, int state) int i=1,x; int len = strlen(com); int start[SYSTEM_DIMENSIONS], end[SYSTEM_DIMENSIONS]; -#ifdef HAVE_BGL +#ifdef HAVE_BG int number=0, y=0, z=0; #endif char letter = '.'; @@ -361,7 +361,7 @@ static int _change_state_bps(char *com, int state) return 0; } -#ifdef HAVE_BGL +#ifdef HAVE_BG if ((com[i] == '[') && (com[i+8] == ']') && ((com[i+4] == 'x') @@ -413,12 +413,12 @@ static int _change_state_bps(char *com, int state) for(x=start[X];x<=end[X];x++) { for(y=start[Y];y<=end[Y];y++) { for(z=start[Z];z<=end[Z];z++) { - if(pa_system_ptr->grid[x][y][z].letter + if(ba_system_ptr->grid[x][y][z].letter != opposite) continue; - pa_system_ptr->grid[x][y][z].color = 0; - pa_system_ptr->grid[x][y][z].letter = letter; - pa_system_ptr->grid[x][y][z].used = used; + ba_system_ptr->grid[x][y][z].color = 0; + ba_system_ptr->grid[x][y][z].letter = letter; + ba_system_ptr->grid[x][y][z].used = used; } } } @@ -450,15 +450,15 @@ static int _change_state_bps(char *com, int state) goto error_message; for(x=start[X];x<=end[X];x++) { - pa_system_ptr->grid[x].color = 0; - pa_system_ptr->grid[x].letter = letter; - pa_system_ptr->grid[x].used = used; + ba_system_ptr->grid[x].color = 0; + ba_system_ptr->grid[x].letter = letter; + ba_system_ptr->grid[x].used = used; } #endif return 1; error_message: memset(error_string,0,255); -#ifdef HAVE_BGL +#ifdef HAVE_BG sprintf(error_string, "Problem with nodes specified range was %d%d%dx%d%d%d", start[X],start[Y],start[Z], @@ -470,10 +470,10 @@ error_message: #endif return 0; } -static int _remove_allocation(char *com, List allocated_partitions) +static int _remove_allocation(char *com, List allocated_blocks) { ListIterator results_i; - allocated_part_t *allocated_part = NULL; + allocated_block_t *allocated_block = NULL; int i=6, found=0; int len = strlen(com); char letter; @@ -490,12 +490,12 @@ static int _remove_allocation(char *com, List allocated_partitions) return 0; } else { letter = com[i]; - results_i = list_iterator_create(allocated_partitions); - while((allocated_part = list_next(results_i)) != NULL) { + results_i = list_iterator_create(allocated_blocks); + while((allocated_block = list_next(results_i)) != NULL) { if(found) { - if(redo_part(allocated_part->nodes, - allocated_part->request->geometry, - allocated_part-> + if(redo_block(allocated_block->nodes, + allocated_block->request->geometry, + allocated_block-> request->conn_type, color_count) == SLURM_ERROR) { memset(error_string,0,255); @@ -503,16 +503,16 @@ static int _remove_allocation(char *com, List allocated_partitions) "problem redoing the part."); return 0; } - allocated_part->letter = + allocated_block->letter = letters[color_count%62]; - allocated_part->color = + allocated_block->color = colors[color_count%6]; - } else if(allocated_part->letter == letter) { + } else if(allocated_block->letter == letter) { found=1; - remove_part(allocated_part->nodes,color_count); - list_destroy(allocated_part->nodes); - delete_pa_request(allocated_part->request); + remove_block(allocated_block->nodes,color_count); + list_destroy(allocated_block->nodes); + delete_ba_request(allocated_block->request); list_remove(results_i); color_count--; } @@ -524,7 +524,7 @@ static int _remove_allocation(char *com, List allocated_partitions) return 1; } -static int _alter_allocation(char *com, List allocated_partitions) +static int _alter_allocation(char *com, List allocated_blocks) { int torus=TORUS, i=5, i2=0; int len = strlen(com); @@ -560,12 +560,12 @@ static int _alter_allocation(char *com, List allocated_partitions) return 1; } -static int _copy_allocation(char *com, List allocated_partitions) +static int _copy_allocation(char *com, List allocated_blocks) { ListIterator results_i; - allocated_part_t *allocated_part = NULL; - allocated_part_t *temp_part = NULL; - pa_request_t *request = NULL; + allocated_block_t *allocated_block = NULL; + allocated_block_t *temp_block = NULL; + ba_request_t *request = NULL; int i=0; int len = strlen(com); @@ -593,19 +593,19 @@ static int _copy_allocation(char *com, List allocated_partitions) } } - results_i = list_iterator_create(allocated_partitions); - while((allocated_part = list_next(results_i)) != NULL) { - temp_part = allocated_part; - if(allocated_part->letter != letter) + results_i = list_iterator_create(allocated_blocks); + while((allocated_block = list_next(results_i)) != NULL) { + temp_block = allocated_block; + if(allocated_block->letter != letter) continue; break; } list_iterator_destroy(results_i); if(!letter) - allocated_part = temp_part; + allocated_block = temp_block; - if(!allocated_part) { + if(!allocated_block) { memset(error_string,0,255); sprintf(error_string, "Could not find requested record to copy"); @@ -613,16 +613,16 @@ static int _copy_allocation(char *com, List allocated_partitions) } for(i=0;i<count;i++) { - request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); + request = (ba_request_t*) xmalloc(sizeof(ba_request_t)); - request->geometry[X] = allocated_part->request->geometry[X]; - request->geometry[Y] = allocated_part->request->geometry[Y]; - request->geometry[Z] = allocated_part->request->geometry[Z]; - request->size = allocated_part->request->size; - request->conn_type=allocated_part->request->conn_type; - request->rotate =allocated_part->request->rotate; - request->elongate = allocated_part->request->elongate; - request->force_contig = allocated_part->request->force_contig; + request->geometry[X] = allocated_block->request->geometry[X]; + request->geometry[Y] = allocated_block->request->geometry[Y]; + request->geometry[Z] = allocated_block->request->geometry[Z]; + request->size = allocated_block->request->size; + request->conn_type=allocated_block->request->conn_type; + request->rotate =allocated_block->request->rotate; + request->elongate = allocated_block->request->elongate; + request->force_contig = allocated_block->request->force_contig; request->rotate_count= 0; request->elongate_count = 0; @@ -639,7 +639,7 @@ static int _copy_allocation(char *com, List allocated_partitions) } list_iterator_destroy(results_i); - if((allocated_part = _make_request(request)) == NULL) { + if((allocated_block = _make_request(request)) == NULL) { memset(error_string,0,255); sprintf(error_string, "Problem with the copy\n" @@ -647,18 +647,18 @@ static int _copy_allocation(char *com, List allocated_partitions) xfree(request); return 0; } - list_append(allocated_partitions, allocated_part); + list_append(allocated_blocks, allocated_block); } return 1; } -static int _save_allocation(char *com, List allocated_partitions) +static int _save_allocation(char *com, List allocated_blocks) { int len = strlen(com); int i=5, j=0; - allocated_part_t *allocated_part = NULL; + allocated_block_t *allocated_block = NULL; char filename[20]; char save_string[255]; FILE *file_ptr = NULL; @@ -681,9 +681,9 @@ static int _save_allocation(char *com, List allocated_partitions) } } if(filename[0]=='\0') { - pa_system_ptr->now_time = time(NULL); + ba_system_ptr->now_time = time(NULL); sprintf(filename,"bluegene.conf.%ld", - (long int) pa_system_ptr->now_time); + (long int) ba_system_ptr->now_time); } file_ptr = fopen(filename,"w"); if (file_ptr!=NULL) { @@ -705,18 +705,18 @@ static int _save_allocation(char *com, List allocated_partitions) fputs ("Numpsets=8\n", file_ptr); fputs ("BridgeAPIVerbose=0\n", file_ptr); - results_i = list_iterator_create(allocated_partitions); - while((allocated_part = list_next(results_i)) != NULL) { + results_i = list_iterator_create(allocated_blocks); + while((allocated_block = list_next(results_i)) != NULL) { memset(save_string,0,255); - if(allocated_part->request->conn_type == TORUS) + if(allocated_block->request->conn_type == TORUS) conn_type = "TORUS"; - else if(allocated_part->request->conn_type == MESH) + else if(allocated_block->request->conn_type == MESH) conn_type = "MESH"; else conn_type = "SMALL"; sprintf(save_string, "Nodes=%s Type=%s\n", - allocated_part->request->save_name, + allocated_block->request->save_name, conn_type); fputs (save_string,file_ptr); } @@ -727,84 +727,84 @@ static int _save_allocation(char *com, List allocated_partitions) static void _print_header_command(void) { - pa_system_ptr->ycord=2; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "ID"); - pa_system_ptr->xcord += 4; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "TYPE"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "CONTIG"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "ROTATE"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "ELONG"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODES"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODELIST"); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord++; + ba_system_ptr->ycord=2; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "ID"); + ba_system_ptr->xcord += 4; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "TYPE"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "CONTIG"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "ROTATE"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "ELONG"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "NODES"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "NODELIST"); + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord++; } -static void _print_text_command(allocated_part_t *allocated_part) +static void _print_text_command(allocated_block_t *allocated_block) { - wattron(pa_system_ptr->text_win, - COLOR_PAIR(allocated_part->color)); + wattron(ba_system_ptr->text_win, + COLOR_PAIR(allocated_block->color)); - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%c",allocated_part->letter); - pa_system_ptr->xcord += 4; - if(allocated_part->request->conn_type==TORUS) - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "TORUS"); - else if (allocated_part->request->conn_type==MESH) - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "MESH"); + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%c",allocated_block->letter); + ba_system_ptr->xcord += 4; + if(allocated_block->request->conn_type==TORUS) + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "TORUS"); + else if (allocated_block->request->conn_type==MESH) + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "MESH"); else - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "SMALL"); - pa_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "SMALL"); + ba_system_ptr->xcord += 7; - if(allocated_part->request->force_contig) - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "Y"); + if(allocated_block->request->force_contig) + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "Y"); else - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "N"); - pa_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "N"); + ba_system_ptr->xcord += 7; - if(allocated_part->request->rotate) - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "Y"); + if(allocated_block->request->rotate) + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "Y"); else - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "N"); - pa_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "N"); + ba_system_ptr->xcord += 7; - if(allocated_part->request->elongate) - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "Y"); + if(allocated_block->request->elongate) + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "Y"); else - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "N"); - pa_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "N"); + ba_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%d",allocated_part->request->size); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%s", - allocated_part->request->save_name); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord++; - wattroff(pa_system_ptr->text_win, - COLOR_PAIR(allocated_part->color)); + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%d",allocated_block->request->size); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%s", + allocated_block->request->save_name); + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord++; + wattroff(ba_system_ptr->text_win, + COLOR_PAIR(allocated_block->color)); return; } @@ -813,34 +813,34 @@ void get_command(void) char com[255]; int text_width, text_startx; - allocated_part_t *allocated_part = NULL; + allocated_block_t *allocated_block = NULL; int i=0; int count=0; WINDOW *command_win; - List allocated_partitions; + List allocated_blocks; ListIterator results_i; if(params.commandline) { printf("Configure won't work with commandline mode.\n"); printf("Please remove the -c from the commandline.\n"); - pa_fini(); + ba_fini(); exit(0); } init_wires(); - allocated_partitions = list_create(NULL); + allocated_blocks = list_create(NULL); - text_width = pa_system_ptr->text_win->_maxx; - text_startx = pa_system_ptr->text_win->_begx; + text_width = ba_system_ptr->text_win->_maxx; + text_startx = ba_system_ptr->text_win->_begx; command_win = newwin(3, text_width - 1, LINES - 4, text_startx + 1); echo(); while (strcmp(com, "quit")) { - clear_window(pa_system_ptr->grid_win); + clear_window(ba_system_ptr->grid_win); print_grid(0); - clear_window(pa_system_ptr->text_win); - box(pa_system_ptr->text_win, 0, 0); - box(pa_system_ptr->grid_win, 0, 0); + clear_window(ba_system_ptr->text_win); + box(ba_system_ptr->text_win, 0, 0); + box(ba_system_ptr->grid_win, 0, 0); if (!params.no_header) _print_header_command(); @@ -849,38 +849,38 @@ void get_command(void) i=0; while(error_string[i]!='\0') { if(error_string[i]=='\n') { - pa_system_ptr->ycord++; - pa_system_ptr->xcord=1; + ba_system_ptr->ycord++; + ba_system_ptr->xcord=1; i++; } - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%c", error_string[i++]); - pa_system_ptr->xcord++; + ba_system_ptr->xcord++; } - pa_system_ptr->ycord++; - pa_system_ptr->xcord=1; + ba_system_ptr->ycord++; + ba_system_ptr->xcord=1; memset(error_string,0,255); } - results_i = list_iterator_create(allocated_partitions); + results_i = list_iterator_create(allocated_blocks); - count = list_count(allocated_partitions) - - (LINES-(pa_system_ptr->ycord+5)); + count = list_count(allocated_blocks) + - (LINES-(ba_system_ptr->ycord+5)); if(count<0) count=0; i=0; - while((allocated_part = list_next(results_i)) != NULL) { + while((allocated_block = list_next(results_i)) != NULL) { if(i>=count) - _print_text_command(allocated_part); + _print_text_command(allocated_block); i++; } list_iterator_destroy(results_i); - wnoutrefresh(pa_system_ptr->text_win); - wnoutrefresh(pa_system_ptr->grid_win); + wnoutrefresh(ba_system_ptr->text_win); + wnoutrefresh(ba_system_ptr->grid_win); doupdate(); clear_window(command_win); @@ -893,8 +893,8 @@ void get_command(void) if (!strcmp(com, "exit")) { endwin(); - _delete_allocated_parts(allocated_partitions); - pa_fini(); + _delete_allocated_blocks(allocated_blocks); + ba_fini(); exit(0); } if (!strcmp(com, "quit")) { break; @@ -902,13 +902,13 @@ void get_command(void) !strncasecmp(com, "r ", 2)) { _resolve(com); } else if (!strncasecmp(com, "resume", 6)) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%s", com); + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%s", com); } else if (!strncasecmp(com, "drain", 5)) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%s", com); + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%s", com); } else if (!strncasecmp(com, "alldown", 7)) { _change_state_all_bps(com, NODE_STATE_DOWN); } else if (!strncasecmp(com, "down", 4)) { @@ -920,33 +920,33 @@ void get_command(void) } else if (!strncasecmp(com, "remove", 6) || !strncasecmp(com, "delete", 6) || !strncasecmp(com, "drop", 4)) { - _remove_allocation(com, allocated_partitions); + _remove_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "alter", 5)) { - _alter_allocation(com, allocated_partitions); + _alter_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "create", 6)) { - _create_allocation(com, allocated_partitions); + _create_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "copy", 4) || !strncasecmp(com, "c ", 2) || !strncasecmp(com, "c\0", 2)) { - _copy_allocation(com, allocated_partitions); + _copy_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "save", 4)) { - _save_allocation(com, allocated_partitions); + _save_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "clear all", 9) || !strncasecmp(com, "clear", 5)) { - _delete_allocated_parts(allocated_partitions); - allocated_partitions = list_create(NULL); + _delete_allocated_blocks(allocated_blocks); + allocated_blocks = list_create(NULL); } else { memset(error_string,0,255); sprintf(error_string, "Unknown command '%s'",com); } } - _delete_allocated_parts(allocated_partitions); + _delete_allocated_blocks(allocated_blocks); params.display = 0; noecho(); - clear_window(pa_system_ptr->text_win); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord = 1; + clear_window(ba_system_ptr->text_win); + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord = 1; print_date(); get_job(0); return; diff --git a/src/smap/grid_functions.c b/src/smap/grid_functions.c index d94f130312a23d6c162b9d7c28166ab55d00240d..e79ad8ea4c04cbb30eeb9d5f46b5e67d7dc17071 100644 --- a/src/smap/grid_functions.c +++ b/src/smap/grid_functions.c @@ -30,52 +30,52 @@ extern int set_grid(int start, int end, int count) { int x; -#ifdef HAVE_BGL +#ifdef HAVE_BG int y, z; for (y = DIM_SIZE[Y] - 1; y >= 0; y--) { for (z = 0; z < DIM_SIZE[Z]; z++) { for (x = 0; x < DIM_SIZE[X]; x++) { - if ((pa_system_ptr->grid[x][y][z].indecies + if ((ba_system_ptr->grid[x][y][z].indecies < start) - || (pa_system_ptr->grid[x][y][z].indecies + || (ba_system_ptr->grid[x][y][z].indecies > end)) continue; - if ((pa_system_ptr->grid[x][y][z].state + if ((ba_system_ptr->grid[x][y][z].state == NODE_STATE_DOWN) - || (pa_system_ptr->grid[x][y][z].state + || (ba_system_ptr->grid[x][y][z].state & NODE_STATE_DRAIN)) continue; - pa_system_ptr->grid[x][y][z].letter = + ba_system_ptr->grid[x][y][z].letter = letters[count%62]; - pa_system_ptr->grid[x][y][z].color = + ba_system_ptr->grid[x][y][z].color = colors[count%6]; } } } #else for (x = 0; x < DIM_SIZE[X]; x++) { - if ((pa_system_ptr->grid[x].indecies < start) - || (pa_system_ptr->grid[x].indecies > end)) + if ((ba_system_ptr->grid[x].indecies < start) + || (ba_system_ptr->grid[x].indecies > end)) continue; - if ((pa_system_ptr->grid[x].state == NODE_STATE_DOWN) - || (pa_system_ptr->grid[x].state & NODE_STATE_DRAIN)) + if ((ba_system_ptr->grid[x].state == NODE_STATE_DOWN) + || (ba_system_ptr->grid[x].state & NODE_STATE_DRAIN)) continue; - pa_system_ptr->grid[x].letter = + ba_system_ptr->grid[x].letter = letters[count%62]; - pa_system_ptr->grid[x].color = + ba_system_ptr->grid[x].color = colors[count%6]; } #endif return 1; } -extern int set_grid_bgl(int *start, int *end, int count, int set) +extern int set_grid_bg(int *start, int *end, int count, int set) { int x=0; int i = 0; -#ifdef HAVE_BGL +#ifdef HAVE_BG int y=0, z=0; #endif assert(end[X] < DIM_SIZE[X]); @@ -83,7 +83,7 @@ extern int set_grid_bgl(int *start, int *end, int count, int set) assert(count >= 0); assert(set >= 0); assert(set <= 2); -#ifdef HAVE_BGL +#ifdef HAVE_BG assert(end[Y] < DIM_SIZE[Y]); assert(start[Y] >= 0); assert(end[Z] < DIM_SIZE[Z]); @@ -93,10 +93,10 @@ extern int set_grid_bgl(int *start, int *end, int count, int set) for (y = start[Y]; y <= end[Y]; y++) { for (z = start[Z]; z <= end[Z]; z++) { if(!set) { - if(pa_system_ptr->grid[x][y][z].letter != '#') { - pa_system_ptr->grid[x][y][z].letter = + if(ba_system_ptr->grid[x][y][z].letter != '#') { + ba_system_ptr->grid[x][y][z].letter = letters[count%62]; - pa_system_ptr->grid[x][y][z].color = + ba_system_ptr->grid[x][y][z].color = colors[count%6]; } } @@ -107,9 +107,9 @@ extern int set_grid_bgl(int *start, int *end, int count, int set) #else for (x = start[X]; x <= end[X]; x++) { if(!set) { - pa_system_ptr->grid[x].letter = + ba_system_ptr->grid[x].letter = letters[count%62]; - pa_system_ptr->grid[x].color = + ba_system_ptr->grid[x].color = colors[count%6]; } i++; @@ -126,7 +126,7 @@ extern void print_grid(int dir) int x; int grid_xcord, grid_ycord = 2; -#ifdef HAVE_BGL +#ifdef HAVE_BG int y, z, offset = DIM_SIZE[Z]; for (y = DIM_SIZE[Y] - 1; y >= 0; y--) { offset = DIM_SIZE[Z] + 1; @@ -134,28 +134,28 @@ extern void print_grid(int dir) grid_xcord = offset; for (x = 0; x < DIM_SIZE[X]; x++) { - if (pa_system_ptr->grid[x][y][z].color) - init_pair(pa_system_ptr-> + if (ba_system_ptr->grid[x][y][z].color) + init_pair(ba_system_ptr-> grid[x][y][z].color, - pa_system_ptr-> + ba_system_ptr-> grid[x][y][z].color, COLOR_BLACK); else - init_pair(pa_system_ptr-> + init_pair(ba_system_ptr-> grid[x][y][z].color, - pa_system_ptr-> + ba_system_ptr-> grid[x][y][z].color, 7); - wattron(pa_system_ptr->grid_win, - COLOR_PAIR(pa_system_ptr-> + wattron(ba_system_ptr->grid_win, + COLOR_PAIR(ba_system_ptr-> grid[x][y][z].color)); - mvwprintw(pa_system_ptr->grid_win, + mvwprintw(ba_system_ptr->grid_win, grid_ycord, grid_xcord, "%c", - pa_system_ptr->grid[x][y][z].letter); - wattroff(pa_system_ptr->grid_win, - COLOR_PAIR(pa_system_ptr-> + ba_system_ptr->grid[x][y][z].letter); + wattroff(ba_system_ptr->grid_win, + COLOR_PAIR(ba_system_ptr-> grid[x][y][z].color)); grid_xcord++; } @@ -169,30 +169,30 @@ extern void print_grid(int dir) grid_ycord=1; for (x = dir; x < DIM_SIZE[X]; x++) { - if (pa_system_ptr->grid[x].color) - init_pair(pa_system_ptr->grid[x].color, - pa_system_ptr->grid[x].color, + if (ba_system_ptr->grid[x].color) + init_pair(ba_system_ptr->grid[x].color, + ba_system_ptr->grid[x].color, COLOR_BLACK); else - init_pair(pa_system_ptr->grid[x].color, - pa_system_ptr->grid[x].color, + init_pair(ba_system_ptr->grid[x].color, + ba_system_ptr->grid[x].color, 7); - wattron(pa_system_ptr->grid_win, - COLOR_PAIR(pa_system_ptr->grid[x].color)); + wattron(ba_system_ptr->grid_win, + COLOR_PAIR(ba_system_ptr->grid[x].color)); - mvwprintw(pa_system_ptr->grid_win, + mvwprintw(ba_system_ptr->grid_win, grid_ycord, grid_xcord, "%c", - pa_system_ptr->grid[x].letter); - wattroff(pa_system_ptr->grid_win, - COLOR_PAIR(pa_system_ptr->grid[x].color)); + ba_system_ptr->grid[x].letter); + wattroff(ba_system_ptr->grid_win, + COLOR_PAIR(ba_system_ptr->grid[x].color)); grid_xcord++; - if(grid_xcord==pa_system_ptr->grid_win->_maxx) { + if(grid_xcord==ba_system_ptr->grid_win->_maxx) { grid_xcord=1; grid_ycord++; } - if(grid_ycord==pa_system_ptr->grid_win->_maxy) { + if(grid_ycord==ba_system_ptr->grid_win->_maxy) { break; } } diff --git a/src/smap/job_functions.c b/src/smap/job_functions.c index b0ba00e9d44d3b6c90828fde9eaee7474ee26c48..5a2074ee7dd37c35d90386921277836d52611a74 100644 --- a/src/smap/job_functions.c +++ b/src/smap/job_functions.c @@ -54,11 +54,11 @@ extern void get_job() if (error_code) { if (quiet_flag != 1) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, 1, + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, 1, "slurm_load_job: %s", slurm_strerror(slurm_get_errno())); - pa_system_ptr->ycord++; + ba_system_ptr->ycord++; } } @@ -98,21 +98,21 @@ extern void get_job() if(!params.commandline) { if((count>=text_line_cnt) && (printed_jobs - < (pa_system_ptr->text_win->_maxy-3))) { + < (ba_system_ptr->text_win->_maxy-3))) { job.num_procs = (int)letters[count%62]; - wattron(pa_system_ptr->text_win, + wattron(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); _print_text_job(&job); - wattroff(pa_system_ptr->text_win, + wattroff(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); printed_jobs++; } } else { job.num_procs = (int)letters[count%62]; - wattron(pa_system_ptr->text_win, + wattron(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); _print_text_job(&job); - wattroff(pa_system_ptr->text_win, + wattroff(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); } count++; @@ -130,23 +130,23 @@ extern void get_job() if(!params.commandline) { if((count>=text_line_cnt) && (printed_jobs - < (pa_system_ptr->text_win->_maxy-3))) { + < (ba_system_ptr->text_win->_maxy-3))) { job.nodes = "waiting..."; job.num_procs = (int) letters[count%62]; - wattron(pa_system_ptr->text_win, + wattron(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); _print_text_job(&job); - wattroff(pa_system_ptr->text_win, + wattroff(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); printed_jobs++; } } else { job.nodes = "waiting..."; job.num_procs = (int) letters[count%62]; - wattron(pa_system_ptr->text_win, + wattron(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); _print_text_job(&job); - wattroff(pa_system_ptr->text_win, + wattroff(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); printed_jobs++; } @@ -159,7 +159,7 @@ extern void get_job() if (params.commandline && params.iterate) printf("\n"); - pa_system_ptr->ycord++; + ba_system_ptr->ycord++; job_info_ptr = new_job_ptr; return; @@ -168,44 +168,44 @@ extern void get_job() static void _print_header_job(void) { if(!params.commandline) { - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "ID"); - pa_system_ptr->xcord += 3; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "JOBID"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "PARTITION"); - pa_system_ptr->xcord += 10; -#ifdef HAVE_BGL - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "BGL_BLOCK"); - pa_system_ptr->xcord += 18; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "ID"); + ba_system_ptr->xcord += 3; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "JOBID"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "PARTITION"); + ba_system_ptr->xcord += 10; +#ifdef HAVE_BG + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "BG_BLOCK"); + ba_system_ptr->xcord += 18; #endif - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "USER"); - pa_system_ptr->xcord += 9; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NAME"); - pa_system_ptr->xcord += 10; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "ST"); - pa_system_ptr->xcord += 6; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "TIME"); - pa_system_ptr->xcord += 5; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODES"); - pa_system_ptr->xcord += 6; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODELIST"); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord++; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "USER"); + ba_system_ptr->xcord += 9; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "NAME"); + ba_system_ptr->xcord += 10; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "ST"); + ba_system_ptr->xcord += 6; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "TIME"); + ba_system_ptr->xcord += 5; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "NODES"); + ba_system_ptr->xcord += 6; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "NODELIST"); + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord++; } else { printf("JOBID "); printf("PARTITION "); -#ifdef HAVE_BGL - printf(" BGL_BLOCK "); +#ifdef HAVE_BG + printf(" BG_BLOCK "); #endif printf(" USER "); printf(" NAME "); @@ -227,84 +227,84 @@ static int _print_text_job(job_info_t * job_ptr) char time_buf[20]; if(!params.commandline) { - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%c", job_ptr->num_procs); - pa_system_ptr->xcord += 3; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%d", job_ptr->job_id); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.10s", job_ptr->partition); - pa_system_ptr->xcord += 10; -#ifdef HAVE_BGL - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.16s", + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%c", job_ptr->num_procs); + ba_system_ptr->xcord += 3; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%d", job_ptr->job_id); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.10s", job_ptr->partition); + ba_system_ptr->xcord += 10; +#ifdef HAVE_BG + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.16s", select_g_sprint_jobinfo(job_ptr->select_jobinfo, time_buf, sizeof(time_buf), - SELECT_PRINT_BGL_ID)); - pa_system_ptr->xcord += 18; + SELECT_PRINT_BG_ID)); + ba_system_ptr->xcord += 18; #endif - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.8s", + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.8s", uid_to_string((uid_t) job_ptr->user_id)); - pa_system_ptr->xcord += 9; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.9s", job_ptr->name); - pa_system_ptr->xcord += 10; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.2s", + ba_system_ptr->xcord += 9; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.9s", job_ptr->name); + ba_system_ptr->xcord += 10; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.2s", job_state_string_compact(job_ptr->job_state)); - pa_system_ptr->xcord += 0; + ba_system_ptr->xcord += 0; if(!strcasecmp(job_ptr->nodes,"waiting...")) { sprintf(time_buf,"0:00:00"); } else { - time = pa_system_ptr->now_time - job_ptr->start_time; + time = ba_system_ptr->now_time - job_ptr->start_time; snprint_time(time_buf, sizeof(time_buf), time); } width = strlen(time_buf); - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord + (10 - width), "%s", + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord + (10 - width), "%s", time_buf); - pa_system_ptr->xcord += 11; + ba_system_ptr->xcord += 11; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%d", job_ptr->num_nodes); - pa_system_ptr->xcord += 6; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%d", job_ptr->num_nodes); + ba_system_ptr->xcord += 6; - tempxcord = pa_system_ptr->xcord; + tempxcord = ba_system_ptr->xcord; while (job_ptr->nodes[i] != '\0') { - if ((printed = mvwaddch(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, + if ((printed = mvwaddch(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, job_ptr->nodes[i])) < 0) return printed; - pa_system_ptr->xcord++; - width = pa_system_ptr->text_win->_maxx - - pa_system_ptr->xcord; + ba_system_ptr->xcord++; + width = ba_system_ptr->text_win->_maxx + - ba_system_ptr->xcord; if (job_ptr->nodes[i] == '[') prefixlen = i + 1; else if (job_ptr->nodes[i] == ',' && (width - 9) <= 0) { - pa_system_ptr->ycord++; - pa_system_ptr->xcord = tempxcord + prefixlen; + ba_system_ptr->ycord++; + ba_system_ptr->xcord = tempxcord + prefixlen; } i++; } - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord++; + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord++; } else { printf("%5d ", job_ptr->job_id); printf("%9.9s ", job_ptr->partition); -#ifdef HAVE_BGL +#ifdef HAVE_BG printf("%16.16s ", select_g_sprint_jobinfo(job_ptr->select_jobinfo, time_buf, sizeof(time_buf), - SELECT_PRINT_BGL_ID)); + SELECT_PRINT_BG_ID)); #endif printf("%8.8s ", uid_to_string((uid_t) job_ptr->user_id)); printf("%6.6s ", job_ptr->name); @@ -313,7 +313,7 @@ static int _print_text_job(job_info_t * job_ptr) if(!strcasecmp(job_ptr->nodes,"waiting...")) { sprintf(time_buf,"0:00:00"); } else { - time = pa_system_ptr->now_time - job_ptr->start_time; + time = ba_system_ptr->now_time - job_ptr->start_time; snprint_time(time_buf, sizeof(time_buf), time); } diff --git a/src/smap/opts.c b/src/smap/opts.c index d71a2bf800d61a129408ca6a3097774e410bde7e..5303c92908eae277d199fe2a470aded49b4760fd 100644 --- a/src/smap/opts.c +++ b/src/smap/opts.c @@ -68,7 +68,7 @@ extern void parse_command_line(int argc, char *argv[]) else if (!strcmp(optarg, "s")) tmp = SLURMPART; else if (!strcmp(optarg, "b")) - tmp = BGLPART; + tmp = BGPART; else if (!strcmp(optarg, "c")) tmp = COMMANDS; @@ -138,15 +138,15 @@ extern void snprint_time(char *buf, size_t buf_size, time_t time) extern void print_date() { - pa_system_ptr->now_time = time(NULL); + ba_system_ptr->now_time = time(NULL); if (params.commandline) { - printf("%s", ctime(&pa_system_ptr->now_time)); + printf("%s", ctime(&ba_system_ptr->now_time)); } else { - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%s", - ctime(&pa_system_ptr->now_time)); - pa_system_ptr->ycord++; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "%s", + ctime(&ba_system_ptr->now_time)); + ba_system_ptr->ycord++; } } diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 5cf6940c45b6d7b3d54e5f3815ca5edce3a30285..46eaf9a003aefa4115ad3ca29e05bc89ed697aec 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -34,12 +34,12 @@ DEF_TIMERS; typedef struct { - char *bgl_user_name; - char *bgl_block_name; + char *bg_user_name; + char *bg_block_name; char *slurm_part_name; char *nodes; - enum connection_type bgl_conn_type; - enum node_use_type bgl_node_use; + enum connection_type bg_conn_type; + enum node_use_type bg_node_use; rm_partition_state_t state; int letter_num; List nodelist; @@ -49,7 +49,7 @@ typedef struct { } db2_block_info_t; -#ifdef HAVE_BGL +#ifdef HAVE_BG static List block_list = NULL; #endif @@ -60,11 +60,11 @@ static void _print_header_part(void); static char *_part_state_str(rm_partition_state_t state); static int _print_text_part(partition_info_t *part_ptr, db2_block_info_t *db2_info_ptr); -#ifdef HAVE_BGL +#ifdef HAVE_BG static void _block_list_del(void *object); static void _nodelist_del(void *object); static int _list_match_all(void *object, void *key); -static int _in_slurm_partition(List slurm_nodes, List bgl_nodes); +static int _in_slurm_partition(List slurm_nodes, List bg_nodes); static int _print_rest(db2_block_info_t *block_ptr); static int _addto_node_list(List nodelist, int *start, int *end); static int _make_nodelist(char *nodes, List nodelist); @@ -93,11 +93,11 @@ extern void get_slurm_part() if (error_code) { if (quiet_flag != 1) { if(!params.commandline) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, 1, + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, 1, "slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); - pa_system_ptr->ycord++; + ba_system_ptr->ycord++; } else { printf("slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); @@ -114,7 +114,7 @@ extern void get_slurm_part() else recs = 0; if (!params.commandline) - if((recs - text_line_cnt) < (pa_system_ptr->text_win->_maxy-3)) + if((recs - text_line_cnt) < (ba_system_ptr->text_win->_maxy-3)) text_line_cnt--; for (i = 0; i < recs; i++) { @@ -133,10 +133,10 @@ extern void get_slurm_part() if(i>=text_line_cnt) { part.root_only = (int) letters[count%62]; - wattron(pa_system_ptr->text_win, + wattron(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); _print_text_part(&part, NULL); - wattroff(pa_system_ptr->text_win, + wattroff(ba_system_ptr->text_win, COLOR_PAIR(colors[count%6])); } count++; @@ -151,17 +151,17 @@ extern void get_slurm_part() return; } -extern void get_bgl_part() +extern void get_bg_part() { -#ifdef HAVE_BGL +#ifdef HAVE_BG int error_code, i, j, recs=0, count = 0, last_count = -1; static partition_info_msg_t *part_info_ptr = NULL; static partition_info_msg_t *new_part_ptr = NULL; - static node_select_info_msg_t *bgl_info_ptr = NULL; - static node_select_info_msg_t *new_bgl_ptr = NULL; + static node_select_info_msg_t *bg_info_ptr = NULL; + static node_select_info_msg_t *new_bg_ptr = NULL; partition_info_t part; - int number, start[PA_SYSTEM_DIMENSIONS], end[PA_SYSTEM_DIMENSIONS]; + int number, start[BA_SYSTEM_DIMENSIONS], end[BA_SYSTEM_DIMENSIONS]; db2_block_info_t *block_ptr = NULL; ListIterator itr; List nodelist = NULL; @@ -183,11 +183,11 @@ extern void get_bgl_part() if (error_code) { if (quiet_flag != 1) { if(!params.commandline) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, 1, + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, 1, "slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); - pa_system_ptr->ycord++; + ba_system_ptr->ycord++; } else { printf("slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); @@ -195,27 +195,27 @@ extern void get_bgl_part() } return; } - if (bgl_info_ptr) { - error_code = slurm_load_node_select(bgl_info_ptr->last_update, - &new_bgl_ptr); + if (bg_info_ptr) { + error_code = slurm_load_node_select(bg_info_ptr->last_update, + &new_bg_ptr); if (error_code == SLURM_SUCCESS) - select_g_free_node_info(&bgl_info_ptr); + select_g_free_node_info(&bg_info_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; - new_bgl_ptr = bgl_info_ptr; + new_bg_ptr = bg_info_ptr; } } else { error_code = slurm_load_node_select((time_t) NULL, - &new_bgl_ptr); + &new_bg_ptr); } if (error_code) { if (quiet_flag != 1) { if(!params.commandline) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, 1, + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, 1, "slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); - pa_system_ptr->ycord++; + ba_system_ptr->ycord++; } else { printf("slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); @@ -234,38 +234,38 @@ extern void get_bgl_part() } } if (!params.commandline) - if((new_bgl_ptr->record_count - text_line_cnt) - < (pa_system_ptr->text_win->_maxy-3)) + if((new_bg_ptr->record_count - text_line_cnt) + < (ba_system_ptr->text_win->_maxy-3)) text_line_cnt--; - for (i=0; i<new_bgl_ptr->record_count; i++) { + for (i=0; i<new_bg_ptr->record_count; i++) { block_ptr = xmalloc(sizeof(db2_block_info_t)); list_append(block_list, block_ptr); - block_ptr->bgl_block_name - = xstrdup(new_bgl_ptr->bgl_info_array[i].bgl_part_id); + block_ptr->bg_block_name + = xstrdup(new_bg_ptr->bg_info_array[i].bg_block_id); block_ptr->nodes - = xstrdup(new_bgl_ptr->bgl_info_array[i].nodes); + = xstrdup(new_bg_ptr->bg_info_array[i].nodes); block_ptr->nodelist = list_create(_nodelist_del); _make_nodelist(block_ptr->nodes,block_ptr->nodelist); - block_ptr->bgl_user_name - = xstrdup(new_bgl_ptr->bgl_info_array[i].owner_name); + block_ptr->bg_user_name + = xstrdup(new_bg_ptr->bg_info_array[i].owner_name); block_ptr->state - = new_bgl_ptr->bgl_info_array[i].state; - block_ptr->bgl_conn_type - = new_bgl_ptr->bgl_info_array[i].conn_type; - block_ptr->bgl_node_use - = new_bgl_ptr->bgl_info_array[i].node_use; + = new_bg_ptr->bg_info_array[i].state; + block_ptr->bg_conn_type + = new_bg_ptr->bg_info_array[i].conn_type; + block_ptr->bg_node_use + = new_bg_ptr->bg_info_array[i].node_use; block_ptr->quarter - = new_bgl_ptr->bgl_info_array[i].quarter; + = new_bg_ptr->bg_info_array[i].quarter; if(block_ptr->quarter < 1) { last_count++; _marknodes(block_ptr, last_count); } else block_ptr->letter_num = last_count; - if(block_ptr->bgl_conn_type == SELECT_SMALL) + if(block_ptr->bg_conn_type == SELECT_SMALL) block_ptr->size = 0; } @@ -302,7 +302,7 @@ extern void get_bgl_part() list_destroy(nodelist); } - /* Report the BGL Blocks */ + /* Report the BG Blocks */ if (block_list) { itr = list_iterator_create(block_list); while ((block_ptr = (db2_block_info_t*) @@ -325,16 +325,16 @@ extern void get_bgl_part() printf("\n"); part_info_ptr = new_part_ptr; - bgl_info_ptr = new_bgl_ptr; -#endif /* HAVE_BGL */ + bg_info_ptr = new_bg_ptr; +#endif /* HAVE_BG */ return; } static int _marknodes(db2_block_info_t *block_ptr, int count) { int j=0; - int start[PA_SYSTEM_DIMENSIONS]; - int end[PA_SYSTEM_DIMENSIONS]; + int start[BA_SYSTEM_DIMENSIONS]; + int end[BA_SYSTEM_DIMENSIONS]; int number = 0; block_ptr->letter_num = count; @@ -364,12 +364,12 @@ static int _marknodes(db2_block_info_t *block_ptr, int count) && end[Y] == (DIM_SIZE[Y]-1) && end[Z] == (DIM_SIZE[Z]-1) && block_ptr->state == RM_PARTITION_FREE) - block_ptr->size += set_grid_bgl(start, + block_ptr->size += set_grid_bg(start, end, count, 1); else - block_ptr->size += set_grid_bgl(start, + block_ptr->size += set_grid_bg(start, end, count, 0); @@ -384,7 +384,7 @@ static int _marknodes(db2_block_info_t *block_ptr, int count) start[Y] = (number % 100) / 10; start[Z] = (number % 10); j+=3; - block_ptr->size += set_grid_bgl(start, + block_ptr->size += set_grid_bg(start, start, count, 0); @@ -399,59 +399,59 @@ static int _marknodes(db2_block_info_t *block_ptr, int count) static void _print_header_part(void) { if(!params.commandline) { - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "ID"); - pa_system_ptr->xcord += 4; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "PARTITION"); - pa_system_ptr->xcord += 10; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "ID"); + ba_system_ptr->xcord += 4; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "PARTITION"); + ba_system_ptr->xcord += 10; - if (params.display != BGLPART) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "AVAIL"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "TIMELIMIT"); - pa_system_ptr->xcord += 11; + if (params.display != BGPART) { + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "AVAIL"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "TIMELIMIT"); + ba_system_ptr->xcord += 11; } else { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "BGL_BLOCK"); - pa_system_ptr->xcord += 18; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "STATE"); - pa_system_ptr->xcord += 8; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "USER"); - pa_system_ptr->xcord += 12; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "CONN"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODE_USE"); - pa_system_ptr->xcord += 10; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "BG_BLOCK"); + ba_system_ptr->xcord += 18; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "STATE"); + ba_system_ptr->xcord += 8; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "USER"); + ba_system_ptr->xcord += 12; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "CONN"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "NODE_USE"); + ba_system_ptr->xcord += 10; } - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODES"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODELIST"); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord++; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "NODES"); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, ba_system_ptr->ycord, + ba_system_ptr->xcord, "NODELIST"); + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord++; } else { printf("PARTITION "); - if (params.display != BGLPART) { + if (params.display != BGPART) { printf("AVAIL "); printf("TIMELIMIT "); } else { - printf(" BGL_BLOCK "); + printf(" BG_BLOCK "); printf("STATE "); printf(" USER "); printf(" CONN "); @@ -467,7 +467,7 @@ static char *_part_state_str(rm_partition_state_t state) { static char tmp[16]; -#ifdef HAVE_BGL +#ifdef HAVE_BG switch (state) { case RM_PARTITION_BUSY: return "BUSY"; @@ -501,39 +501,39 @@ static int _print_text_part(partition_info_t *part_ptr, char *nodes = NULL, time_buf[20]; if(!params.commandline) { - if((params.display == BGLPART) + if((params.display == BGPART) && db2_info_ptr->quarter != -1) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%c.%d", + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%c.%d", part_ptr->root_only, db2_info_ptr->quarter); } else { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%c", + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%c", part_ptr->root_only); } - pa_system_ptr->xcord += 4; + ba_system_ptr->xcord += 4; if (part_ptr->name) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.9s", + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.9s", part_ptr->name); - pa_system_ptr->xcord += 10; - if (params.display != BGLPART) { + ba_system_ptr->xcord += 10; + if (params.display != BGPART) { if (part_ptr->state_up) - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "UP"); else - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "DOWN"); - pa_system_ptr->xcord += 7; + ba_system_ptr->xcord += 7; if (part_ptr->max_time == INFINITE) snprintf(time_buf, sizeof(time_buf), @@ -546,132 +546,132 @@ static int _print_text_part(partition_info_t *part_ptr, } width = strlen(time_buf); - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord + (9 - width), + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord + (9 - width), "%s", time_buf); - pa_system_ptr->xcord += 11; + ba_system_ptr->xcord += 11; } } else - pa_system_ptr->xcord += 10; + ba_system_ptr->xcord += 10; - if (params.display == BGLPART) { + if (params.display == BGPART) { if (db2_info_ptr) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.16s", - db2_info_ptr->bgl_block_name); - pa_system_ptr->xcord += 18; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.16s", + db2_info_ptr->bg_block_name); + ba_system_ptr->xcord += 18; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, _part_state_str( db2_info_ptr->state)); - pa_system_ptr->xcord += 8; + ba_system_ptr->xcord += 8; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.11s", - db2_info_ptr->bgl_user_name); - pa_system_ptr->xcord += 12; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.11s", + db2_info_ptr->bg_user_name); + ba_system_ptr->xcord += 12; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.5s", + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.5s", _convert_conn_type( db2_info_ptr-> - bgl_conn_type)); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%.9s", + bg_conn_type)); + ba_system_ptr->xcord += 7; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%.9s", _convert_node_use( - db2_info_ptr->bgl_node_use)); - pa_system_ptr->xcord += 10; + db2_info_ptr->bg_node_use)); + ba_system_ptr->xcord += 10; } else { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "?"); - pa_system_ptr->xcord += 12; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "?"); - pa_system_ptr->xcord += 8; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "?"); - pa_system_ptr->xcord += 12; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "?"); - pa_system_ptr->xcord += 6; - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "?"); - pa_system_ptr->xcord += 10; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "?"); + ba_system_ptr->xcord += 12; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "?"); + ba_system_ptr->xcord += 8; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "?"); + ba_system_ptr->xcord += 12; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "?"); + ba_system_ptr->xcord += 6; + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "?"); + ba_system_ptr->xcord += 10; } } if(part_ptr->total_nodes == 0) - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "0.25"); + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "0.25"); else - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, "%d", + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, "%d", part_ptr->total_nodes); - pa_system_ptr->xcord += 7; + ba_system_ptr->xcord += 7; - tempxcord = pa_system_ptr->xcord; + tempxcord = ba_system_ptr->xcord; - if (params.display == BGLPART) + if (params.display == BGPART) nodes = part_ptr->allow_groups; else nodes = part_ptr->nodes; prefixlen = i; while (nodes && nodes[i]) { - width = pa_system_ptr->text_win->_maxx - - pa_system_ptr->xcord; + width = ba_system_ptr->text_win->_maxx + - ba_system_ptr->xcord; if (!prefixlen && nodes[i] == '[' && nodes[i - 1] == ',') prefixlen = i + 1; if (nodes[i - 1] == ',' && (width - 12) <= 0) { - pa_system_ptr->ycord++; - pa_system_ptr->xcord = tempxcord + prefixlen; - } else if (pa_system_ptr->xcord > - pa_system_ptr->text_win->_maxx) { - pa_system_ptr->ycord++; - pa_system_ptr->xcord = tempxcord + prefixlen; + ba_system_ptr->ycord++; + ba_system_ptr->xcord = tempxcord + prefixlen; + } else if (ba_system_ptr->xcord > + ba_system_ptr->text_win->_maxx) { + ba_system_ptr->ycord++; + ba_system_ptr->xcord = tempxcord + prefixlen; } - if ((printed = mvwaddch(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, + if ((printed = mvwaddch(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, nodes[i])) < 0) return printed; - pa_system_ptr->xcord++; + ba_system_ptr->xcord++; i++; } - if((params.display == BGLPART) + if((params.display == BGPART) && (db2_info_ptr->quarter != -1)) { - mvwprintw(pa_system_ptr->text_win, - pa_system_ptr->ycord, - pa_system_ptr->xcord, ".%d", + mvwprintw(ba_system_ptr->text_win, + ba_system_ptr->ycord, + ba_system_ptr->xcord, ".%d", db2_info_ptr->quarter); } - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord++; + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord++; } else { if (part_ptr->name) { printf("%9.9s ", part_ptr->name); - if (params.display != BGLPART) { + if (params.display != BGPART) { if (part_ptr->state_up) printf(" UP "); else @@ -692,19 +692,19 @@ static int _print_text_part(partition_info_t *part_ptr, } } - if (params.display == BGLPART) { + if (params.display == BGPART) { if (db2_info_ptr) { printf("%16.16s ", - db2_info_ptr->bgl_block_name); + db2_info_ptr->bg_block_name); printf("%5.5s ", _part_state_str(db2_info_ptr->state)); - printf("%8.8s ", db2_info_ptr->bgl_user_name); + printf("%8.8s ", db2_info_ptr->bg_user_name); printf("%5.5s ", _convert_conn_type( - db2_info_ptr->bgl_conn_type)); + db2_info_ptr->bg_conn_type)); printf("%9.9s ", _convert_node_use( - db2_info_ptr->bgl_node_use)); + db2_info_ptr->bg_node_use)); } } @@ -713,14 +713,14 @@ static int _print_text_part(partition_info_t *part_ptr, else printf("%5d ", part_ptr->total_nodes); - tempxcord = pa_system_ptr->xcord; + tempxcord = ba_system_ptr->xcord; - if (params.display == BGLPART) + if (params.display == BGPART) nodes = part_ptr->allow_groups; else nodes = part_ptr->nodes; - if((params.display == BGLPART) + if((params.display == BGPART) && (db2_info_ptr->quarter != -1)) printf("%s.%d\n", nodes, db2_info_ptr->quarter); else @@ -729,14 +729,14 @@ static int _print_text_part(partition_info_t *part_ptr, return printed; } -#ifdef HAVE_BGL +#ifdef HAVE_BG static void _block_list_del(void *object) { db2_block_info_t *block_ptr = (db2_block_info_t *)object; if (block_ptr) { - xfree(block_ptr->bgl_user_name); - xfree(block_ptr->bgl_block_name); + xfree(block_ptr->bg_user_name); + xfree(block_ptr->bg_block_name); xfree(block_ptr->slurm_part_name); xfree(block_ptr->nodes); if(block_ptr->nodelist) @@ -760,17 +760,17 @@ static int _list_match_all(void *object, void *key) return 1; } -static int _in_slurm_partition(List slurm_nodes, List bgl_nodes) +static int _in_slurm_partition(List slurm_nodes, List bg_nodes) { ListIterator slurm_itr; - ListIterator bgl_itr; + ListIterator bg_itr; int *coord = NULL; int *slurm_coord = NULL; int found = 0; - bgl_itr = list_iterator_create(bgl_nodes); + bg_itr = list_iterator_create(bg_nodes); slurm_itr = list_iterator_create(slurm_nodes); - while ((coord = list_next(bgl_itr)) != NULL) { + while ((coord = list_next(bg_itr)) != NULL) { list_iterator_reset(slurm_itr); found = 0; while ((slurm_coord = list_next(slurm_itr)) != NULL) { @@ -786,7 +786,7 @@ static int _in_slurm_partition(List slurm_nodes, List bgl_nodes) } } list_iterator_destroy(slurm_itr); - list_iterator_destroy(bgl_itr); + list_iterator_destroy(bg_itr); if(found) return 1; @@ -812,10 +812,10 @@ static int _print_rest(db2_block_info_t *block_ptr) return SLURM_SUCCESS; part.allow_groups = block_ptr->nodes; part.root_only = (int) letters[block_ptr->letter_num%62]; - wattron(pa_system_ptr->text_win, + wattron(ba_system_ptr->text_win, COLOR_PAIR(colors[block_ptr->letter_num%6])); _print_text_part(&part, block_ptr); - wattroff(pa_system_ptr->text_win, + wattroff(ba_system_ptr->text_win, COLOR_PAIR(colors[block_ptr->letter_num%6])); return SLURM_SUCCESS; @@ -851,8 +851,8 @@ static int _make_nodelist(char *nodes, List nodelist) { int j = 0; int number; - int start[PA_SYSTEM_DIMENSIONS]; - int end[PA_SYSTEM_DIMENSIONS]; + int start[BA_SYSTEM_DIMENSIONS]; + int end[BA_SYSTEM_DIMENSIONS]; if(!nodelist) nodelist = list_create(_nodelist_del); diff --git a/src/smap/smap.c b/src/smap/smap.c index adf929d6aefc17800d85667906395263194ef460..4c77c867b8119c1171412927662bad5d049b3046 100644 --- a/src/smap/smap.c +++ b/src/smap/smap.c @@ -32,7 +32,7 @@ #include <signal.h> #include "src/smap/smap.h" -#ifdef HAVE_BGL +#ifdef HAVE_BG #define MIN_SCREEN_WIDTH 92 #else #define MIN_SCREEN_WIDTH 72 @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) int end = 0; int i; int rc; -#ifdef HAVE_BGL +#ifdef HAVE_BG int mapset = 0; #endif //char *name; @@ -86,13 +86,13 @@ int main(int argc, char *argv[]) exit(1); sleep(10); /* keep trying to reconnect */ } - pa_init(new_node_ptr); + ba_init(new_node_ptr); if(params.partition) { -#ifdef HAVE_BGL_FILES +#ifdef HAVE_BG_FILES if (!have_db2) { - printf("must be on BGL SN to resolve.\n"); + printf("must be on BG SN to resolve.\n"); goto part_fini; } @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) } else { int *coord = find_bp_loc(params.partition); if(coord) - printf("%s resolves to X=%d Y=%d Z=%d or bgl%d%d%d\n", + printf("%s resolves to X=%d Y=%d Z=%d or bg%d%d%d\n", params.partition, coord[X], coord[Y], coord[Z], coord[X], coord[Y], coord[Z]); @@ -133,9 +133,9 @@ int main(int argc, char *argv[]) } part_fini: #else - printf("must be on BGL SN to resolve.\n"); + printf("must be on BG SN to resolve.\n"); #endif - pa_fini(); + ba_fini(); exit(0); } if(!params.commandline) { @@ -143,7 +143,7 @@ part_fini: signal(SIGWINCH, (sighandler_t) _resize_handler); initscr(); -#ifdef HAVE_BGL +#ifdef HAVE_BG height = DIM_SIZE[Y] * DIM_SIZE[Z] + DIM_SIZE[Y] + 3; width = DIM_SIZE[X] + DIM_SIZE[Z] + 3; if (COLS < (MIN_SCREEN_WIDTH + width) || LINES < height) { @@ -161,7 +161,7 @@ part_fini: height, COLS, LINES); - pa_fini(); + ba_fini(); exit(0); } @@ -174,15 +174,15 @@ part_fini: start_color(); _set_pairs(); - pa_system_ptr->grid_win = newwin(height, + ba_system_ptr->grid_win = newwin(height, width, starty, startx); - max_display = pa_system_ptr->grid_win->_maxy - *pa_system_ptr->grid_win->_maxx; - //scrollok(pa_system_ptr->grid_win, TRUE); + max_display = ba_system_ptr->grid_win->_maxy + *ba_system_ptr->grid_win->_maxx; + //scrollok(ba_system_ptr->grid_win, TRUE); -#ifdef HAVE_BGL +#ifdef HAVE_BG startx = width; COLS -= 2; width = COLS - width; @@ -194,7 +194,7 @@ part_fini: #endif - pa_system_ptr->text_win = newwin(height, + ba_system_ptr->text_win = newwin(height, width, starty, startx); @@ -204,14 +204,14 @@ part_fini: _get_option(); redraw: - clear_window(pa_system_ptr->text_win); - clear_window(pa_system_ptr->grid_win); + clear_window(ba_system_ptr->text_win); + clear_window(ba_system_ptr->grid_win); doupdate(); move(0,0); init_grid(new_node_ptr); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord = 1; + ba_system_ptr->xcord = 1; + ba_system_ptr->ycord = 1; } print_date(); switch (params.display) { @@ -221,38 +221,38 @@ part_fini: case SLURMPART: get_slurm_part(); break; -#ifdef HAVE_BGL +#ifdef HAVE_BG case COMMANDS: if(!mapset) { mapset = set_bp_map(); - wclear(pa_system_ptr->text_win); + wclear(ba_system_ptr->text_win); //doupdate(); //move(0,0); } get_command(); break; - case BGLPART: - get_bgl_part(); + case BGPART: + get_bg_part(); break; #else default: - error("must be on a BGL SYSTEM to run this command"); + error("must be on a BG SYSTEM to run this command"); endwin(); - pa_fini(); + ba_fini(); exit(0); break; #endif } if(!params.commandline) { - //wscrl(pa_system_ptr->grid_win,-1); - box(pa_system_ptr->text_win, 0, 0); - wnoutrefresh(pa_system_ptr->text_win); + //wscrl(ba_system_ptr->grid_win,-1); + box(ba_system_ptr->text_win, 0, 0); + wnoutrefresh(ba_system_ptr->text_win); print_grid(grid_line_cnt* - (pa_system_ptr->grid_win->_maxx-1)); - box(pa_system_ptr->grid_win, 0, 0); - wnoutrefresh(pa_system_ptr->grid_win); + (ba_system_ptr->grid_win->_maxx-1)); + box(ba_system_ptr->grid_win, 0, 0); + wnoutrefresh(ba_system_ptr->grid_win); doupdate(); @@ -276,13 +276,13 @@ part_fini: if (error_code && (quiet_flag != 1)) { if(!params.commandline) { mvwprintw( - pa_system_ptr->text_win, - pa_system_ptr->ycord, + ba_system_ptr->text_win, + ba_system_ptr->ycord, 1, "slurm_load_node: %s", slurm_strerror( slurm_get_errno())); - pa_system_ptr->ycord++; + ba_system_ptr->ycord++; } else { printf("slurm_load_node: %s", slurm_strerror( @@ -298,9 +298,9 @@ part_fini: if(!params.commandline) { if ((rc = _get_option()) == 1) goto redraw; - else if (pa_system_ptr-> + else if (ba_system_ptr-> resize_screen) { - pa_system_ptr-> + ba_system_ptr-> resize_screen = 0; goto redraw; } @@ -316,7 +316,7 @@ part_fini: getch(); endwin(); } - pa_fini(); + ba_fini(); exit(0); } @@ -357,11 +357,11 @@ static int _get_option() params.display = JOBS; return 1; break; -#ifdef HAVE_BGL +#ifdef HAVE_BG case 'b': text_line_cnt = 0; grid_line_cnt = 0; - params.display = BGLPART; + params.display = BGPART; return 1; break; case 'c': @@ -370,7 +370,7 @@ static int _get_option() break; #endif -#ifndef HAVE_BGL +#ifndef HAVE_BG case 'u': case KEY_UP: grid_line_cnt--; @@ -383,7 +383,7 @@ static int _get_option() case 'd': case KEY_DOWN: grid_line_cnt++; - if((((grid_line_cnt-2)*(pa_system_ptr->grid_win->_maxx-1)) + + if((((grid_line_cnt-2)*(ba_system_ptr->grid_win->_maxx-1)) + max_display) > DIM_SIZE[X]) { grid_line_cnt--; return 0; @@ -395,7 +395,7 @@ static int _get_option() case 'q': case '\n': endwin(); - pa_fini(); + ba_fini(); exit(0); break; } @@ -406,10 +406,10 @@ static void *_resize_handler(int sig) { int startx=0, starty=0; int height, width; - pa_system_ptr->ycord = 1; + ba_system_ptr->ycord = 1; - delwin(pa_system_ptr->grid_win); - delwin(pa_system_ptr->text_win); + delwin(ba_system_ptr->grid_win); + delwin(ba_system_ptr->text_win); endwin(); COLS=0; @@ -417,7 +417,7 @@ static void *_resize_handler(int sig) initscr(); getmaxyx(stdscr,LINES,COLS); -#ifdef HAVE_BGL +#ifdef HAVE_BG height = DIM_SIZE[Y] * DIM_SIZE[Z] + DIM_SIZE[Y] + 3; width = DIM_SIZE[X] + DIM_SIZE[Z] + 3; if (COLS < (MIN_SCREEN_WIDTH + width) || LINES < height) { @@ -432,15 +432,15 @@ static void *_resize_handler(int sig) error("Screen is too small make sure " "the screen is at least %dx%d\n" "Right now it is %dx%d\n", width, height, COLS, LINES); - pa_fini(); + ba_fini(); exit(0); } - pa_system_ptr->grid_win = newwin(height, width, starty, startx); - max_display = pa_system_ptr->grid_win->_maxy* - pa_system_ptr->grid_win->_maxx; + ba_system_ptr->grid_win = newwin(height, width, starty, startx); + max_display = ba_system_ptr->grid_win->_maxy* + ba_system_ptr->grid_win->_maxx; -#ifdef HAVE_BGL +#ifdef HAVE_BG startx = width; COLS -= 2; width = COLS - width; @@ -452,7 +452,7 @@ static void *_resize_handler(int sig) #endif - pa_system_ptr->text_win = newwin(height, width, starty, startx); + ba_system_ptr->text_win = newwin(height, width, starty, startx); print_date(); switch (params.display) { @@ -462,23 +462,23 @@ static void *_resize_handler(int sig) case SLURMPART: get_slurm_part(); break; -#ifdef HAVE_BGL +#ifdef HAVE_BG case COMMANDS: get_command(); break; - case BGLPART: - get_bgl_part(); + case BGPART: + get_bg_part(); break; #endif } - print_grid(grid_line_cnt*(pa_system_ptr->grid_win->_maxx-1)); - box(pa_system_ptr->text_win, 0, 0); - box(pa_system_ptr->grid_win, 0, 0); - wnoutrefresh(pa_system_ptr->text_win); - wnoutrefresh(pa_system_ptr->grid_win); + print_grid(grid_line_cnt*(ba_system_ptr->grid_win->_maxx-1)); + box(ba_system_ptr->text_win, 0, 0); + box(ba_system_ptr->grid_win, 0, 0); + wnoutrefresh(ba_system_ptr->text_win); + wnoutrefresh(ba_system_ptr->grid_win); doupdate(); - pa_system_ptr->resize_screen = 1; + ba_system_ptr->resize_screen = 1; return NULL; } diff --git a/src/smap/smap.h b/src/smap/smap.h index 7b2137d1f9e27d7fde49d255d0ae24a5eb0e4f47..f10dab4f8ac3b6baf2b8c5a00291b7d3ec817e58 100644 --- a/src/smap/smap.h +++ b/src/smap/smap.h @@ -60,7 +60,7 @@ #include "src/common/hostlist.h" #include "src/common/list.h" #include "src/common/macros.h" -#include "src/partition_allocator/partition_allocator.h" +#include "src/plugins/select/bluegene/block_allocator/block_allocator.h" #include "src/common/slurm_protocol_api.h" #include "src/plugins/select/bluegene/wrap_rm_api.h" @@ -70,7 +70,7 @@ #define OPT_LONG_USAGE 0x101 #define OPT_LONG_HIDE 0x102 -enum { JOBS, SLURMPART, BGLPART, COMMANDS }; +enum { JOBS, SLURMPART, BGPART, COMMANDS }; typedef void (*sighandler_t) (int); @@ -103,13 +103,13 @@ extern int text_line_cnt; extern void parse_command_line(int argc, char *argv[]); -extern pa_system_t *pa_system_ptr; +extern ba_system_t *ba_system_ptr; extern int quiet_flag; extern void init_grid(node_info_msg_t *node_info_ptr); extern int set_grid(int start, int end, int count); -extern int set_grid_bgl(int *start, int *end, int count, int set); +extern int set_grid_bg(int *start, int *end, int count, int set); extern void print_grid(int dir); extern void parse_command_line(int argc, char *argv[]); @@ -118,7 +118,7 @@ extern void print_date(); extern void clear_window(WINDOW *win); extern void get_slurm_part(); -extern void get_bgl_part(); +extern void get_bg_part(); extern void get_job(); extern void get_command(); diff --git a/src/srun/opt.c b/src/srun/opt.c index 7246cd7fd6a3bc1fca068180c7a9d1802b60c9fd..5a17f78665d1faab32b60a81e6f66121ab397db4 100644 --- a/src/srun/opt.c +++ b/src/srun/opt.c @@ -1678,7 +1678,7 @@ static void _usage(void) " [--contiguous] [--mincpus=n] [--mem=MB] [--tmp=MB] [-C list]\n" " [--mpi=type] [--account=name] [--dependency=jobid]\n" " [--kill-on-bad-exit] [--propagate[=rlimits] ]\n" -#ifdef HAVE_BGL /* Blue gene specific options */ +#ifdef HAVE_BG /* Blue gene specific options */ " [--geometry=XxYxZ] [--conn-type=type] [--no-rotate]\n" #endif " [--mail-type=type] [mail-user=user]\n" @@ -1766,7 +1766,7 @@ static void _help(void) "\n" #endif -#ifdef HAVE_BGL /* Blue gene specific options */ +#ifdef HAVE_BG /* Blue gene specific options */ "Blue Gene related options:\n" " -g, --geometry=XxYxZ geometry constraints of the job\n" " -R, --no-rotate disable geometry rotation\n"