├── .gitignore ├── .gitlab-ci.yml ├── AUTHORS ├── COPYING ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── aclocal.m4 ├── autogen.sh ├── bridge.spec ├── build-aux ├── ar-lib ├── compile ├── config.guess ├── config.sub ├── depcomp ├── install-sh ├── ltmain.sh ├── missing └── ylwrap ├── build ├── almalinux8 │ └── Dockerfile └── almalinux9 │ └── Dockerfile ├── config.h.in ├── configure ├── configure.ac ├── etc ├── Makefile.am ├── Makefile.in ├── bridge.conf.in ├── bridge_bs.conf.in ├── bridge_rm.conf.in ├── bridged.conf.in ├── bridgedapi.conf.in ├── init.d │ ├── Makefile.am │ ├── Makefile.in │ ├── bridged.in │ └── bridged.service ├── logrotate.d │ ├── Makefile.am │ ├── Makefile.in │ ├── bridged │ └── bridged.systemd.in └── sysconfig │ ├── Makefile.am │ ├── Makefile.in │ └── bridged ├── lib ├── Makefile.am ├── Makefile.in ├── bridge │ ├── Makefile.am │ ├── Makefile.in │ ├── bridge.h │ ├── bridge_common.c │ ├── bridge_common.h │ ├── bridge_idlist.c │ ├── bridge_manager.c │ ├── bridge_nodelist.c │ └── bridge_range.c ├── bridged │ ├── Makefile.am │ ├── Makefile.in │ ├── bridge_engine.c │ ├── bridge_engine.h │ ├── bridge_request.c │ ├── bridge_request.h │ ├── bridge_rus.c │ ├── bridge_rus.h │ ├── bridgedapi.c │ └── bridgedapi.h ├── confparse │ ├── Makefile.am │ ├── Makefile.in │ ├── analyse.c │ ├── analyse.h │ ├── conf_lex.c │ ├── conf_lex.l │ ├── conf_yacc.c │ ├── conf_yacc.h │ ├── conf_yacc.y │ ├── config_parsing.c │ └── config_parsing.h └── xternal │ ├── Makefile.am │ ├── Makefile.in │ ├── xerror.h │ ├── xfreelist.c │ ├── xfreelist.h │ ├── xlibrary.c │ ├── xlibrary.h │ ├── xlogger.c │ ├── xlogger.h │ ├── xmessage.c │ ├── xmessage.h │ ├── xqueue.c │ ├── xqueue.h │ ├── xstream.c │ └── xstream.h ├── m4 ├── bridge.m4 ├── libtool.m4 ├── lsf.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 ├── lt~obsolete.m4 ├── nqsII.m4 ├── slurm.m4 └── torque.m4 ├── plugins ├── Makefile.am ├── Makefile.in ├── batch │ ├── Makefile.am │ ├── Makefile.in │ ├── lsf │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── lsf_batch_manager.c │ │ ├── lsf_batch_node.c │ │ ├── lsf_batch_queue.c │ │ └── lsf_batch_session.c │ ├── lsf_slurm │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── lsf_batch_manager.c │ │ ├── lsf_batch_node.c │ │ ├── lsf_batch_queue.c │ │ └── lsf_batch_session.c │ ├── slurm │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── batch_common.c │ │ ├── batch_common.h │ │ ├── batch_manager.c │ │ ├── batch_node.c │ │ ├── batch_queue.c │ │ └── batch_session.c │ └── torque │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── batch_common.c │ │ ├── batch_common.h │ │ ├── batch_manager.c │ │ ├── batch_node.c │ │ ├── batch_queue.c │ │ └── batch_session.c └── rm │ ├── Makefile.am │ ├── Makefile.in │ └── slurm │ ├── Makefile.am │ ├── Makefile.in │ └── slurm_rm_manager.c ├── scripts ├── Makefile.am ├── Makefile.in ├── addons │ ├── Makefile.am │ ├── Makefile.in │ ├── array.ad │ ├── autoaccount.ad │ ├── autocarto.ad │ ├── autodefmem.ad │ ├── autoexclusive.ad │ ├── automem-slurm-resize.ad │ ├── automem-slurm.ad │ ├── autompi.ad │ ├── autopacking.ad │ ├── autoqueue.ad │ ├── autoswitches-slurm.ad │ ├── bcast.ad │ ├── bridge-profile.ad │ ├── bulk-flux.ad │ ├── bullmpi-slurm-direct.ad │ ├── bullmpi-slurm-pin.ad │ ├── bullmpi-slurm.ad │ ├── bullxmpi-slurm-direct.ad │ ├── bullxmpi-slurm-pin.ad │ ├── bullxmpi-slurm.ad │ ├── compat-DAM.ad │ ├── ddt.ad │ ├── dirige.ad │ ├── env-cleaner.ad │ ├── example.ad │ ├── filesystems.ad │ ├── flux.ad │ ├── intelmpi-slurm.ad │ ├── inter-para-limits.ad │ ├── logger.ad │ ├── mpmd-cluster-heterogenous.ad │ ├── mpmd-cluster-wrapper.ad │ ├── mpmd-cluster.ad │ ├── mpmd-ws.ad │ ├── mvapich-slurm.ad │ ├── mvapich2-slurm.ad │ ├── openmpi-slurm-direct.ad │ ├── openmpi-slurm.ad │ ├── preload.ad │ ├── qos.ad │ ├── relax_affinity.ad │ ├── reservation.ad │ ├── shell.ad │ ├── spank-stats.ad │ ├── spank-stats.sh │ ├── stdio-flux.ad │ ├── strace.ad │ ├── strace.sh │ ├── tagoutput.ad │ ├── totalview.ad │ ├── vtune.ad │ ├── vtune.sh.in │ ├── wrapper-DAM.ad │ └── x11.ad ├── batch_system │ ├── Makefile.am │ ├── Makefile.in │ ├── mdel.in │ ├── mpp.in │ ├── mstat.in │ ├── msub.in │ ├── plugins │ │ ├── flux │ │ ├── generic │ │ ├── lsf │ │ ├── nqsII │ │ ├── slurm │ │ └── torque │ └── profiles │ │ ├── lsf.sh │ │ ├── nqsII.sh │ │ └── slurm.sh ├── common │ ├── Makefile.am │ ├── Makefile.in │ ├── bridge_addon │ ├── bridge_command.in │ ├── bridge_lock_mgr │ ├── bridge_printer │ ├── bridge_readconf │ └── bridge_toolbox └── resource_manager │ ├── Makefile.am │ ├── Makefile.in │ ├── addons │ └── get_task_info │ ├── mpinfo.in │ ├── mprun.in │ ├── mpstat.in │ ├── plugins │ ├── flux │ ├── generic │ ├── lsf │ ├── nqsII │ ├── rms │ ├── slurm │ ├── torque │ └── ws │ └── profiles │ ├── rms.sh │ └── slurm.sh └── src ├── Makefile.am ├── Makefile.in ├── bridge ├── Makefile.am ├── Makefile.in ├── bmstat.c ├── bnstat.c ├── bqstat.c ├── bsstat.c ├── idlist.c ├── nodelist.c ├── rmastat.c ├── rmmstat.c └── rmpstat.c ├── bridged ├── Makefile.am ├── Makefile.in ├── bridged.c ├── bridged_engine.c ├── bridged_engine.h ├── worker.c └── worker.h ├── bridgedc ├── Makefile.am ├── Makefile.in └── bridgedc.c └── helpers ├── Makefile.am ├── Makefile.in ├── bridge.mpmd.wrapper.c └── bridge.mpmd.wrapper.logic.c /.gitignore: -------------------------------------------------------------------------------- 1 | # editors temporary files 2 | *~ 3 | .*.swp 4 | 5 | # files generated by configure 6 | .deps/ 7 | /autom4te.cache/ 8 | /config.h 9 | /config.log 10 | /config.status 11 | /libtool 12 | /stamp-h1 13 | Makefile 14 | *.tar.gz 15 | 16 | etc/bridge.conf 17 | etc/bridge_bs.conf 18 | etc/bridge_rm.conf 19 | etc/bridged.conf 20 | etc/bridgedapi.conf 21 | etc/init.d/bridged 22 | scripts/addons/vtune.sh 23 | scripts/batch_system/mdel 24 | scripts/batch_system/mpp 25 | scripts/batch_system/mstat 26 | scripts/batch_system/msub 27 | scripts/common/bridge_command 28 | scripts/resource_manager/mpinfo 29 | scripts/resource_manager/mprun 30 | scripts/resource_manager/mpstat 31 | etc/logrotate.d/bridged.systemd 32 | 33 | # files generated by compiler/linker 34 | *.la 35 | *.lo 36 | *.o 37 | .libs/ 38 | 39 | src/bridge/bmstat 40 | src/bridge/bnstat 41 | src/bridge/bqstat 42 | src/bridge/bsstat 43 | src/bridge/idlist 44 | src/bridge/nodelist 45 | src/bridge/rmastat 46 | src/bridge/rmmstat 47 | src/bridge/rmpstat 48 | src/bridged/bridged 49 | src/bridgedc/bridgedc 50 | src/helpers/mpmd_wrapper 51 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - check 3 | - basebuild 4 | - build 5 | 6 | rpm-check: 7 | stage: check 8 | script: 9 | - ~/bin/perfecto bridge.spec 10 | - docker --version 11 | 12 | build-dist: 13 | stage: basebuild 14 | script: 15 | - ./configure --with-slurm --with-slurm-lib 16 | - make 17 | - make dist 18 | artifacts: 19 | paths: 20 | - bridge-*.tar.gz 21 | expire_in: 1 week 22 | 23 | # Building bridge for different systems with different version of slurm. 24 | # Slurm versions must be named as they are in schedMD's download web site. 25 | # DISTRIBUTION refers to a directory under `build` directory. 26 | # The docker process of building must put the results of the build into 27 | # a /dist directory that will be extracted. 28 | build-parametric: 29 | parallel: 30 | matrix: 31 | - DISTRIBUTION: [almalinux8, almalinux9] 32 | SLURM: [slurm-24.05.0, slurm-23.11.8, slurm-22.05.11] 33 | stage: build 34 | script: 35 | # we use a directory named against $DISTRIBUTION in which we have 36 | # our Dockerfile used to build bridge 37 | - cd build/$DISTRIBUTION 38 | # Getting slurm form the source 39 | - https_proxy='http://webproxy:3128' curl -O https://download.schedmd.com/slurm/$SLURM.tar.bz2 40 | # Extracting slurm.spec from source to be used in the Dockerfiles 41 | - tar jOxvf $SLURM.tar.bz2 $SLURM/slurm.spec > slurm.spec 42 | # Copying bridge source and bridge spec file built in build-dist job 43 | - cp ../../bridge-*.tar.gz . 44 | - cp ../../bridge.spec . 45 | # Creating the directory where we will put our builds results 46 | - mkdir $DISTRIBUTION-$SLURM 47 | # Building with a tag in order to be able to run it 48 | - docker build -t $DISTRIBUTION-$SLURM . 49 | # Running the build to extract the /dist directory 50 | - docker run --rm $DISTRIBUTION-$SLURM tar -cC /dist . | tar -xC $DISTRIBUTION-$SLURM/ 51 | # Moving it to get cleaner artifacts 52 | - mv $DISTRIBUTION-$SLURM/ ../../ 53 | artifacts: 54 | name: $DISTRIBUTION-$SLURM 55 | paths: 56 | - $DISTRIBUTION-$SLURM/bridge-*.rpm 57 | expire_in: 1 week 58 | dependencies: 59 | - build-dist 60 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Francis BELOT 2 | Philippe DENIEL 3 | Francois DIAKHATE 4 | Matthieu HAUTREUX 5 | Thomas LEIBOVICI 6 | Philippe GREGOIRE -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | AM_CPPFLAGS = -D_THREAD_SAFE -I$(top_srcdir)/lib -pthread 4 | 5 | AM_LDFLAGS = -pthread 6 | 7 | SUBDIRS = lib plugins src scripts etc 8 | 9 | EXTRA_DIST = bridge.spec NEWS COPYING 10 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | aclocal 4 | libtoolize 5 | automake --gnu --add-missing --copy 6 | autoconf 7 | -------------------------------------------------------------------------------- /build/almalinux8/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM almalinux:8 AS build-stage 2 | 3 | WORKDIR /usr/local/src 4 | COPY slurm-*.tar.bz2 /usr/local/src/ 5 | COPY slurm.spec /usr/local/src/ 6 | COPY bridge-*.tar.gz /usr/local/src/ 7 | COPY bridge.spec /usr/local/src/ 8 | 9 | # Installs epel 10 | # RUN dnf install -y epel-release 11 | 12 | # Installs basic tools to be able to compile a bit 13 | RUN dnf check-update && dnf update -y ; \ 14 | dnf install -y git cmake gcc make rpm-build libtool ; \ 15 | dnf install -y yum-utils; 16 | 17 | # Enables Code Ready Builder repository to get munge-devel package 18 | RUN dnf config-manager --set-enabled powertools; \ 19 | dnf install -y epel-release; 20 | 21 | # Needed to build slurm 22 | RUN dnf install -y munge munge-libs munge-devel mariadb-devel pam-devel readline-devel perl-ExtUtils-MakeMaker python36 23 | 24 | # Needed to build bridge 25 | RUN dnf install -y autoconf automake libtirpc-devel clustershell; 26 | 27 | # Building slurm's rpm and installing them 28 | RUN mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} 29 | RUN cp /usr/local/src/slurm-*.tar.bz2 /root/rpmbuild/SOURCES/ 30 | RUN cp /usr/local/src/slurm.spec /root/rpmbuild/SPECS/ 31 | RUN cd /root/rpmbuild && rpmbuild -v -ba SPECS/slurm.spec 32 | RUN dnf -y localinstall /root/rpmbuild/RPMS/x86_64/*.rpm 33 | 34 | # Building bridge rpm 35 | RUN cp /usr/local/src/bridge-*.tar.gz /root/rpmbuild/SOURCES/ 36 | RUN cp /usr/local/src/bridge.spec /root/rpmbuild/SPECS/ 37 | RUN cd /root/rpmbuild && rpmbuild -v -ba SPECS/bridge.spec 38 | 39 | # Trying to install it 40 | RUN dnf -y localinstall /root/rpmbuild/RPMS/x86_64/bridge*.rpm 41 | 42 | FROM almalinux:8 AS export-stage 43 | RUN mkdir /dist 44 | COPY --from=build-stage /root/rpmbuild/RPMS/x86_64/bridge*.rpm /dist/ 45 | COPY --from=build-stage /root/rpmbuild/SRPMS/bridge*.rpm /dist/ 46 | RUN ls -ls /dist/ 47 | -------------------------------------------------------------------------------- /build/almalinux9/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM almalinux:9 AS build-stage 2 | 3 | WORKDIR /usr/local/src 4 | COPY slurm-*.tar.bz2 /usr/local/src/ 5 | COPY slurm.spec /usr/local/src/ 6 | COPY bridge-*.tar.gz /usr/local/src/ 7 | COPY bridge.spec /usr/local/src/ 8 | 9 | # Installs basic tools to be able to compile a bit 10 | RUN dnf check-update && dnf update -y ; \ 11 | dnf install -y git cmake gcc make rpm-build libtool ; \ 12 | dnf install -y yum-utils; 13 | 14 | # Enables Code Ready Builder repository to get munge-devel package 15 | RUN dnf config-manager --set-enabled crb ; \ 16 | dnf install -y epel-release; 17 | 18 | # Needed to build slurm 19 | RUN dnf install -y munge munge-libs munge-devel mariadb-devel pam-devel readline-devel perl-ExtUtils-MakeMaker 20 | 21 | # Needed to build bridge 22 | RUN dnf install -y autoconf automake libtirpc-devel clustershell; 23 | 24 | # Building slurm's rpm and installing them 25 | RUN mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} 26 | RUN cp /usr/local/src/slurm-*.tar.bz2 /root/rpmbuild/SOURCES/ 27 | RUN cp /usr/local/src/slurm.spec /root/rpmbuild/SPECS/ 28 | RUN cd /root/rpmbuild && rpmbuild -v -ba SPECS/slurm.spec 29 | RUN dnf -y localinstall /root/rpmbuild/RPMS/x86_64/*.rpm 30 | 31 | # Building bridge rpm 32 | RUN cp /usr/local/src/bridge-*.tar.gz /root/rpmbuild/SOURCES/ 33 | RUN cp /usr/local/src/bridge.spec /root/rpmbuild/SPECS/ 34 | RUN cd /root/rpmbuild && rpmbuild -v -ba SPECS/bridge.spec 35 | 36 | # Trying to install it 37 | RUN dnf -y localinstall /root/rpmbuild/RPMS/x86_64/bridge*.rpm 38 | 39 | FROM almalinux:9 AS export-stage 40 | RUN mkdir /dist 41 | COPY --from=build-stage /root/rpmbuild/RPMS/x86_64/bridge*.rpm /dist/ 42 | COPY --from=build-stage /root/rpmbuild/SRPMS/bridge*.rpm /dist/ 43 | RUN ls -ls /dist/ 44 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_LSF_LSBATCH_H 11 | 12 | /* Define to 1 if you have the header file. */ 13 | #undef HAVE_LSF_LSF_H 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_LSF_OPENLSFSLURM_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_MEMORY_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_NQSII_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_PBS_ERROR_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_PBS_IFL_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_RPC_TYPES_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_SLURM_SLURM_H 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_STDINT_H 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_STDLIB_H 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #undef HAVE_STRINGS_H 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #undef HAVE_STRING_H 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #undef HAVE_SYS_STAT_H 50 | 51 | /* Define to 1 if you have the header file. */ 52 | #undef HAVE_SYS_TYPES_H 53 | 54 | /* Define to 1 if you have the header file. */ 55 | #undef HAVE_UNISTD_H 56 | 57 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 58 | #undef LT_OBJDIR 59 | 60 | /* Name of package */ 61 | #undef PACKAGE 62 | 63 | /* Define to the address where bug reports for this package should be sent. */ 64 | #undef PACKAGE_BUGREPORT 65 | 66 | /* Define to the full name of this package. */ 67 | #undef PACKAGE_NAME 68 | 69 | /* Define to the full name and version of this package. */ 70 | #undef PACKAGE_STRING 71 | 72 | /* Define to the one symbol short name of this package. */ 73 | #undef PACKAGE_TARNAME 74 | 75 | /* Define to the home page for this package. */ 76 | #undef PACKAGE_URL 77 | 78 | /* Define to the version of this package. */ 79 | #undef PACKAGE_VERSION 80 | 81 | /* Define to 1 if you have the ANSI C header files. */ 82 | #undef STDC_HEADERS 83 | 84 | /* Version number of package */ 85 | #undef VERSION 86 | 87 | /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a 88 | `char[]'. */ 89 | #undef YYTEXT_POINTER 90 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl Package initialisation 2 | AC_INIT([bridge], [1.5.14], []) 3 | 4 | dnl set auxiliary scripts directory (install-sh,...) 5 | AC_CONFIG_AUX_DIR([build-aux]) 6 | 7 | dnl set in-house m4 macro directory 8 | AC_CONFIG_MACRO_DIR([m4]) 9 | 10 | dnl foreign package 11 | AM_INIT_AUTOMAKE([-Wall -Werror foreign]) 12 | 13 | dnl build configure.h 14 | AC_CONFIG_HEADERS([config.h]) 15 | 16 | dnl check ar for static libraries 17 | dnl AM_PROG_AR was introduced in automake 1.11.2 so we cannot use it directly 18 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 19 | 20 | dnl build lib using autotools .la format 21 | AC_PROG_LIBTOOL 22 | 23 | dnl C code 24 | AC_PROG_CC 25 | AM_PROG_CC_C_O 26 | 27 | dnl lex an yacc support 28 | AC_PROG_LEX 29 | AM_PROG_LEX 30 | AC_PROG_YACC 31 | 32 | dnl set bridge default parameters 33 | AX_BRIDGE 34 | 35 | dnl look for Platform-LSF Batch system support 36 | AX_LSF 37 | 38 | dnl look for Platform-LSF Batch system with Slurm binding support 39 | AX_LSF_SLURM 40 | 41 | dnl look for NQSII Batch system support 42 | AX_NQSII 43 | 44 | dnl look for Torque Batch system support 45 | AX_TORQUE 46 | 47 | dnl look for slurm RM system support 48 | AX_SLURM 49 | 50 | dnl libraries requirements 51 | PKG_PROG_PKG_CONFIG([0.23]) 52 | 53 | dnl checking for rpc/types.h headers and if 54 | dnl not found it checks for libtirpc 55 | AC_CHECK_HEADERS([rpc/types.h], [], 56 | [ 57 | LIBTIRPC_VERSION=1.1.4 58 | AC_SUBST(LIBTIRPC_VERSION) 59 | PKG_CHECK_MODULES(LIBTIRPC, [libtirpc >= $LIBTIRPC_VERSION]) 60 | AC_SUBST(LIBTIRPC_CFLAGS) 61 | AC_SUBST(LIBTIRPC_LIBS) 62 | ] 63 | ) 64 | 65 | dnl *********************************************************************** 66 | dnl * If we are running automake >= 1.11, we can * 67 | dnl * have nicer compilation output. silent option * 68 | dnl *********************************************************************** 69 | AC_ARG_ENABLE([silent], 70 | [ --disable-silent Disable quiet compilation], 71 | [case "${enableval}" in 72 | yes) silent=false ;; 73 | no) silent=true ;; 74 | *) AC_MSG_ERROR([bad value ${enableval} for --disable-silent]) ;; 75 | esac],[silent=false]) 76 | if test x$silent = xtrue 77 | then 78 | AM_SILENT_RULES([no]) 79 | else 80 | AM_SILENT_RULES([yes]) 81 | fi 82 | 83 | 84 | 85 | dnl build these conf files 86 | AC_CONFIG_FILES([Makefile 87 | lib/Makefile 88 | lib/confparse/Makefile 89 | lib/xternal/Makefile 90 | lib/bridge/Makefile 91 | lib/bridged/Makefile 92 | plugins/Makefile 93 | plugins/batch/Makefile 94 | plugins/batch/lsf/Makefile 95 | plugins/batch/lsf_slurm/Makefile 96 | plugins/batch/torque/Makefile 97 | plugins/batch/slurm/Makefile 98 | plugins/rm/Makefile 99 | plugins/rm/slurm/Makefile 100 | src/Makefile 101 | src/bridge/Makefile 102 | src/bridged/Makefile 103 | src/bridgedc/Makefile 104 | src/helpers/Makefile 105 | scripts/Makefile 106 | scripts/common/Makefile 107 | scripts/common/bridge_command:scripts/common/bridge_command.in 108 | scripts/batch_system/Makefile 109 | scripts/batch_system/msub:scripts/batch_system/msub.in 110 | scripts/batch_system/mstat:scripts/batch_system/mstat.in 111 | scripts/batch_system/mpp:scripts/batch_system/mpp.in 112 | scripts/batch_system/mdel:scripts/batch_system/mdel.in 113 | scripts/resource_manager/Makefile 114 | scripts/resource_manager/mprun:scripts/resource_manager/mprun.in 115 | scripts/resource_manager/mpstat:scripts/resource_manager/mpstat.in 116 | scripts/resource_manager/mpinfo:scripts/resource_manager/mpinfo.in 117 | scripts/addons/Makefile 118 | scripts/addons/vtune.sh:scripts/addons/vtune.sh.in 119 | etc/Makefile 120 | etc/bridge.conf:etc/bridge.conf.in 121 | etc/bridge_bs.conf:etc/bridge_bs.conf.in 122 | etc/bridge_rm.conf:etc/bridge_rm.conf.in 123 | etc/bridged.conf:etc/bridged.conf.in 124 | etc/bridgedapi.conf:etc/bridgedapi.conf.in 125 | etc/init.d/bridged:etc/init.d/bridged.in 126 | etc/init.d/Makefile 127 | etc/logrotate.d/bridged.systemd 128 | etc/logrotate.d/Makefile 129 | etc/sysconfig/Makefile]) 130 | 131 | dnl output all declared files 132 | AC_OUTPUT 133 | 134 | AC_MSG_NOTICE([ 135 | *** Flags that will be used to compile *** 136 | CFLAGS : ${CFLAGS} 137 | LDFLAGS : ${LDFLAGS} 138 | LIBTIRPC CFLAGS : ${LIBTIRPC_CFLAGS} 139 | LIBTIRPC LIBS : ${LIBTIRPC_LIBS} 140 | *** Dumping configuration *** 141 | - Host : $host 142 | - Target : $target 143 | - Build For OS : $build_os 144 | - Compiler : ${CC} 145 | - Prefix : $prefix 146 | - Exec prefix : ${exec_prefix} 147 | You can now run 'make' to compile bridge. 148 | ]) 149 | -------------------------------------------------------------------------------- /etc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = init.d logrotate.d sysconfig 2 | 3 | sysconf_DATA = bridge.conf \ 4 | bridgedapi.conf bridged.conf \ 5 | bridge_bs.conf \ 6 | bridge_rm.conf 7 | -------------------------------------------------------------------------------- /etc/bridge.conf.in: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------# 2 | # @PACKAGE@ library configuration file 3 | # (Generated using autotools) 4 | #------------------------------------------------------------------------------# 5 | 6 | #------------------------------------------------------------------------------# 7 | # Global Informations 8 | #------------------------------------------------------------------------------# 9 | global { 10 | # plugins_dir = @prefix@/lib ; 11 | bs_rm_binding = @BRIDGE_BINDING@ ; # one of batchid | rmid | none 12 | 13 | logfile = /dev/stdout ; 14 | loglevel = 0 ; 15 | debugfile = /dev/stdout ; 16 | debuglevel = 0; 17 | } 18 | #------------------------------------------------------------------------------# 19 | 20 | #------------------------------------------------------------------------------# 21 | # Batch system informations 22 | #------------------------------------------------------------------------------# 23 | batch_system { 24 | name = @BRIDGE_BATCH_SYSTEM@ ; 25 | plugin = @BRIDGE_BATCH_PLUGIN@ ; 26 | } 27 | #------------------------------------------------------------------------------# 28 | 29 | #------------------------------------------------------------------------------# 30 | # Resource manager informations (required if bs_rm_binding differs from none) 31 | #------------------------------------------------------------------------------# 32 | rm_system { 33 | name = @BRIDGE_RM_SYSTEM@ ; 34 | plugin = @BRIDGE_RM_PLUGIN@ ; 35 | } 36 | #------------------------------------------------------------------------------# 37 | 38 | #------------------------------------------------------------------------------# 39 | # Bridged Stats Daemon - Client API configuration 40 | #------------------------------------------------------------------------------# 41 | bridgedapi { 42 | primary_address = "localhost" ; 43 | primary_port = 12346 ; 44 | 45 | secondary_address = "localhost" ; 46 | secondary_port = 12346 ; 47 | 48 | timeout = 10 ; 49 | 50 | logfile = "/tmp/bridgeapi.log" ; 51 | loglevel = 0 ; 52 | debugfile = "/tmp/bridgeapi.log" ; 53 | debuglevel = 0 ; 54 | } 55 | #------------------------------------------------------------------------------# 56 | -------------------------------------------------------------------------------- /etc/bridge_bs.conf.in: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------# 2 | # @PACKAGE@ batch system related scripts configuration file 3 | # (Generated using autotools) 4 | #------------------------------------------------------------------------------# 5 | BATCH_SYSTEM=@BRIDGE_BATCH_SYSTEM@ 6 | BRIDGE_BINDING=@BRIDGE_BINDING@ 7 | 8 | BRIDGE_MSTAT_EXCLUDED_QUEUES= 9 | 10 | BRIDGE_MSUB_DEFAULT_NNODE= 11 | BRIDGE_MSUB_DEFAULT_NPROC= 12 | BRIDGE_MSUB_DEFAULT_NCORE= 13 | BRIDGE_MSUB_DEFAULT_QUEUE= 14 | BRIDGE_MSUB_DEFAULT_MAXSTIME= 15 | BRIDGE_MSUB_DEFAULT_MAXSMEM= 16 | BRIDGE_MSUB_DEFAULT_MAXMEM= 17 | BRIDGE_MSUB_DEFAULT_MAXTIME= 18 | BRIDGE_MSUB_DEFAULT_EXTRA_PARAMETERS= 19 | 20 | # on homogeneous clusters, can be set to 21 | # let msub guess the max number of process per 22 | # node when -c option is used 23 | # "auto" means try to guess from local cpuinfo file 24 | BRIDGE_MSUB_MAX_NCORE=auto 25 | 26 | # addons 27 | BRIDGE_ADDONS= 28 | -------------------------------------------------------------------------------- /etc/bridge_rm.conf.in: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------# 2 | # @PACKAGE@ batch system related scripts configuration file 3 | # (Generated using autotools) 4 | #------------------------------------------------------------------------------# 5 | RESOURCE_MANAGER=@BRIDGE_RM_SYSTEM@ 6 | BRIDGE_BINDING=@BRIDGE_BINDING@ 7 | 8 | BRIDGE_MPSTAT_EXCLUDED_PARTITIONS= 9 | 10 | # default parameters than can be set 11 | BRIDGE_MPRUN_DEFAULT_NCORE= 12 | BRIDGE_MPRUN_DEFAULT_NPROC= 13 | BRIDGE_MPRUN_DEFAULT_NNODE= 14 | BRIDGE_MPRUN_DEFAULT_PARTITION= 15 | BRIDGE_MPRUN_DEFAULT_MAXMEM= 16 | BRIDGE_MPRUN_DEFAULT_MAXTIME= 17 | BRIDGE_MPRUN_DEFAULT_EXTRA_PARAMETERS= 18 | 19 | # exclusive mode configuration 20 | # exclusive mode requires that all nodes share the same amount of cores 21 | # that must be defined in BRIDGE_MPRUN_MAX_NCORE 22 | BRIDGE_MPRUN_EXCLUSIVE=no 23 | BRIDGE_MPRUN_EXCLUSIVE_THRESHOLD= 24 | BRIDGE_MPRUN_MAX_NCORE= 25 | 26 | # addons 27 | BRIDGE_ADDONS= 28 | -------------------------------------------------------------------------------- /etc/bridged.conf.in: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------# 2 | # @PACKAGE@ library configuration file 3 | # (Generated using autotools) 4 | #------------------------------------------------------------------------------# 5 | 6 | #------------------------------------------------------------------------------# 7 | # Bridge Stats Daemon - Daemon configuration 8 | #------------------------------------------------------------------------------# 9 | bridged { 10 | 11 | address = "" ; 12 | port = 12346 ; 13 | 14 | cachedir = "/tmp" ; 15 | timeout = 10 ; 16 | 17 | worker = 5 ; 18 | queue = "20000" ; 19 | 20 | logfile = "/var/log/bridged.log" ; 21 | loglevel = 1 ; 22 | debugfile = "/var/log/bridged.log" ; 23 | debuglevel = 0 ; 24 | 25 | } 26 | #------------------------------------------------------------------------------# 27 | 28 | #------------------------------------------------------------------------------# 29 | # Bridge Stats Daemon - Stats collect configuration 30 | #------------------------------------------------------------------------------# 31 | rus_mgr { 32 | 33 | protection_time = "0"; 34 | refresh_interval = "60"; 35 | synchro_command = "\ 36 | @prefix@/bin/ccc_bsstat -o batchid,partimeused,partimelim 2>/dev/null"; 37 | 38 | } 39 | #------------------------------------------------------------------------------# 40 | -------------------------------------------------------------------------------- /etc/bridgedapi.conf.in: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------# 2 | # @PACKAGE@ bridged API configuration file 3 | # (Generated using autotools) 4 | #------------------------------------------------------------------------------# 5 | 6 | #------------------------------------------------------------------------------# 7 | # Bridged Stats Daemon - Client API configuration 8 | #------------------------------------------------------------------------------# 9 | bridgedapi { 10 | primary_address = "localhost" ; 11 | primary_port = 12346 ; 12 | 13 | secondary_address = "localhost" ; 14 | secondary_port = 12346 ; 15 | 16 | timeout = 10 ; 17 | 18 | logfile = "/tmp/bridgeapi.log" ; 19 | loglevel = 0 ; 20 | debugfile = "/tmp/bridgeapi.log" ; 21 | debuglevel = 0 ; 22 | } 23 | #------------------------------------------------------------------------------# 24 | 25 | -------------------------------------------------------------------------------- /etc/init.d/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | initddir = $(sysconfdir)/init.d 3 | 4 | dist_initd_SCRIPTS = bridged 5 | 6 | EXTRA_DIST = bridged.service 7 | -------------------------------------------------------------------------------- /etc/init.d/bridged.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Init file for Bridged daemon 4 | # 5 | # chkconfig: 2345 55 25 6 | # description: Bridge Stats Daemon 7 | # 8 | # processname: bridged 9 | 10 | # source function library 11 | . /etc/rc.d/init.d/functions 12 | 13 | export PATH=${PATH}:@prefix@/sbin 14 | 15 | typeset program_transform_prefix="@program_transform_name@" 16 | if [[ -z ${program_transform_prefix} ]] 17 | then 18 | program_transform_prefix="s,^,," 19 | fi 20 | 21 | prog="bridged" 22 | prog="$(echo ${prog} | sed ${program_transform_prefix})" 23 | 24 | # pull in sysconfig settings 25 | [ -f /etc/sysconfig/${prog} ] && . /etc/sysconfig/${prog} 26 | 27 | RETVAL=0 28 | 29 | PID_FILE=/var/run/${prog}.pid 30 | 31 | start() 32 | { 33 | 34 | echo -n $"Starting $prog:" 35 | initlog -c "$prog ${BRIDGED_OPTIONS} "&& success || failure 36 | RETVAL=$? 37 | [ "$RETVAL" = 0 ] && touch /var/lock/subsys/${prog} 38 | echo 39 | } 40 | 41 | stop() 42 | { 43 | echo -n $"Stopping $prog:" 44 | killproc ${prog} -TERM 45 | RETVAL=$? 46 | [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/${prog} 47 | echo 48 | } 49 | 50 | reload() 51 | { 52 | echo -n $"Reloading $prog:" 53 | killproc ${prog} -HUP 54 | RETVAL=$? 55 | echo 56 | } 57 | 58 | case "$1" in 59 | start) 60 | start 61 | ;; 62 | stop) 63 | stop 64 | ;; 65 | restart) 66 | stop 67 | start 68 | ;; 69 | reload) 70 | reload 71 | ;; 72 | condrestart) 73 | if [ -f /var/lock/subsys/${prog} ] ; then 74 | do_restart_sanity_check 75 | if [ "$RETVAL" = 0 ] ; then 76 | stop 77 | # avoid race 78 | sleep 3 79 | start 80 | fi 81 | fi 82 | ;; 83 | status) 84 | status ${prog} 85 | RETVAL=$? 86 | ;; 87 | *) 88 | echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" 89 | RETVAL=1 90 | esac 91 | exit $RETVAL 92 | -------------------------------------------------------------------------------- /etc/init.d/bridged.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Bridge Stats Daemon 3 | After=network.target 4 | 5 | [Service] 6 | Type=simple 7 | EnvironmentFile=-/etc/sysconfig/bridged 8 | ExecStart=/usr/sbin/bridged -F $BRIDGED_OPTIONS 9 | ExecReload=/bin/kill -HUP $MAINPID 10 | Restart=on-failure 11 | LimitNOFILE=32768 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | -------------------------------------------------------------------------------- /etc/logrotate.d/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | logrotateddir = $(sysconfdir)/logrotate.d 3 | 4 | dist_logrotated_SCRIPTS = bridged bridged.systemd 5 | -------------------------------------------------------------------------------- /etc/logrotate.d/bridged: -------------------------------------------------------------------------------- 1 | /var/log/bridged.log { 2 | missingok 3 | nomail 4 | nocompress 5 | rotate 7 6 | size=10M 7 | postrotate 8 | [ -x /etc/init.d/bridged ] && /etc/init.d/bridged reload 9 | endscript 10 | } 11 | -------------------------------------------------------------------------------- /etc/logrotate.d/bridged.systemd.in: -------------------------------------------------------------------------------- 1 | /var/log/bridged.log { 2 | missingok 3 | nomail 4 | compress 5 | rotate 7 6 | size=10M 7 | postrotate 8 | patt="@program_transform_name@" 9 | if [ -z "${patt}" ] ; then patt="s,^,," ; fi 10 | prog="$(echo bridged | sed ${patt})" 11 | systemctl reload ${prog} 12 | endscript 13 | } 14 | -------------------------------------------------------------------------------- /etc/sysconfig/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | sysconfigdir = $(sysconfdir)/sysconfig 3 | 4 | dist_sysconfig_SCRIPTS = bridged 5 | -------------------------------------------------------------------------------- /etc/sysconfig/bridged: -------------------------------------------------------------------------------- 1 | BRIDGED_OPTIONS= 2 | -------------------------------------------------------------------------------- /lib/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = confparse xternal bridge bridged 2 | -------------------------------------------------------------------------------- /lib/bridge/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libbridge.la 2 | 3 | include_HEADERS = bridge.h bridge_common.h 4 | 5 | libbridge_la_SOURCES = bridge_common.c bridge_idlist.c bridge_manager.c bridge_nodelist.c \ 6 | bridge_range.c bridge_common.h bridge.h 7 | 8 | libbridge_la_CPPFLAGS = -D_THREAD_SAFE -I$(top_srcdir) -I../ -pthread \ 9 | -DBRIDGE_CONF=\"$(sysconfdir)/bridge.conf\" 10 | 11 | libbridge_la_LDFLAGS = $(LIB_LDFLAGS) -pthread 12 | 13 | libbridge_la_LIBADD = ../confparse/libconfig_parsing.la ../xternal/libxternal.la 14 | -------------------------------------------------------------------------------- /lib/bridged/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libbridgedapi.la 2 | 3 | noinst_HEADERS = bridge_engine.h \ 4 | bridge_request.h \ 5 | bridge_rus.h 6 | 7 | include_HEADERS = bridgedapi.h 8 | 9 | libbridgedapi_la_SOURCES = bridge_engine.c \ 10 | bridge_request.c \ 11 | bridge_rus.c \ 12 | bridgedapi.c 13 | 14 | libbridgedapi_la_CPPFLAGS = -D_THREAD_SAFE -I$(top_srcdir)/lib -pthread -DBRIDGEDAPI_CONF=\"$(sysconfdir)/bridgedapi.conf\" $(LIBTIRPC_CFLAGS) 15 | libbridgedapi_la_LDFLAGS = $(LIB_LDFLAGS) -version-info 0:1:0 -pthread 16 | libbridgedapi_la_LIBADD = $(top_srcdir)/lib/confparse/libconfig_parsing.la \ 17 | $(top_srcdir)/lib/xternal/libxternal.la $(LIBTIRPC_LIBS) 18 | 19 | -------------------------------------------------------------------------------- /lib/bridged/bridge_engine.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * lib/bridged/bridge_engine.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | /** 24 | * \file bridge_engine.h 25 | * \author M. Hautreux 26 | * \date 07/28/2008 27 | * \brief Bridge Engine headers 28 | */ 29 | #ifndef __BRIDGE_ENGINE_H_ 30 | #define __BRIDGE_ENGINE_H_ 31 | 32 | /*! \addtogroup BRIDGE_API 33 | * @{ 34 | */ 35 | 36 | /*! \addtogroup BRIDGE_ENGINE 37 | * @{ 38 | */ 39 | 40 | #ifndef BRIDGEDAPI_CONF 41 | #define BRIDGEDAPI_CONF "/etc/bridgedapi.conf" 42 | #endif 43 | 44 | /*! 45 | * \struct bridge_engine 46 | * \typedef bridge_engine_t 47 | * \brief bridge client engine 48 | */ 49 | typedef struct bridge_engine { 50 | 51 | char* primary_address;//!< primary bridge server hostname or address 52 | char* primary_port;//!< primary bridge server hservice name or port 53 | 54 | char* secondary_address;//!< secondary bridge server hostname or address 55 | char* secondary_port;//!< secondary bridge server hservice name or port 56 | 57 | int retries;//!< max retries number per server 58 | time_t timeout;//!< communication timeout 59 | 60 | char* logfile;//!< log messages go to this file (NULL means no log) 61 | int loglevel;//!< log level 62 | char* debugfile;//!< debug messages go to this file (NULL means no debug) 63 | int debuglevel;//!< debug level 64 | 65 | } bridge_engine_t; 66 | 67 | 68 | /*! 69 | * \brief initialize bridge engine structure 70 | * \internal 71 | * 72 | * \param engine pointer on the structure to initialize 73 | * 74 | * \param primary_address address of the primary Bridge server 75 | * \param primary_port port of the primary Bridge server 76 | * \param primary_principal kerberos V principal of the primary Bridge server 77 | * \param primary_keytab file that contain the kerberos keytab of the primary Bridge server 78 | * 79 | * \param secondary_address address of the secondary Bridge server 80 | * \param secondary_port port of the secondary Bridge server 81 | * \param secondary_principal kerberos V principal of the secondary Bridge server 82 | * \param secondary_keytab file that contain the kerberos keytab of the secondary Bridge server 83 | * 84 | * \param timeout timeout in seconds of communication stages 85 | * 86 | * \param logfile file that wil be used to store verbosity 87 | * \param loglevel verbosity level 88 | * 89 | * \param debugfile file that wil be used to store debug data 90 | * \param debuglevel debug level 91 | * 92 | * \retval XSUCCESS success 93 | * \retval XERROR generic error 94 | * 95 | */ 96 | int 97 | bridge_engine_init(bridge_engine_t* engine, 98 | char* primary_address, 99 | char* primary_port, 100 | char* secondary_address, 101 | char* secondary_port, 102 | time_t timeout, 103 | char* logfile, 104 | int loglevel, 105 | char* debugfile, 106 | int debuglevel); 107 | 108 | /*! 109 | * \brief initialize bridge engine structure \a engine based on configuration elements of file \a conf_file 110 | * \internal 111 | * 112 | * \param engine pointer on the structure to initialize 113 | * \param conf_file configuration file to use 114 | * 115 | * \retval XSUCCESS success 116 | * \retval XERROR generic error 117 | * 118 | */ 119 | int 120 | bridge_engine_init_from_config_file(bridge_engine_t* engine,char* conf_file); 121 | 122 | 123 | /*! 124 | * \brief free bridge engine structure contents 125 | * \internal 126 | * 127 | * \param engine pointer on the structure to destroy 128 | * 129 | * \retval XSUCCESS success 130 | * \retval XERROR generic error 131 | * 132 | */ 133 | int 134 | bridge_engine_free_contents(bridge_engine_t* engine); 135 | 136 | /*! 137 | * @} 138 | */ 139 | 140 | /*! 141 | * @} 142 | */ 143 | 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /lib/bridged/bridgedapi.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * lib/bridged/bridgedapi.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #ifndef __BRIDGEDAPI_H_ 24 | #define __BRIDGEDAPI_H_ 25 | 26 | #ifndef XSUCCESS 27 | #define XSUCCES 0 28 | #endif 29 | 30 | #ifndef XERROR 31 | #define XERROR -1 32 | #endif 33 | 34 | 35 | /*! \addtogroup BRIDGEDAPI 36 | * @{ 37 | */ 38 | 39 | #define BRIDGE_SUCCESS 0 40 | #define BRIDGE_ERROR -1 41 | 42 | /* bridge engine related error codes */ 43 | #define BRIDGE_ERROR_ENGINE_INIT_FAILED -1101 44 | 45 | /* communication related error codes */ 46 | #define BRIDGE_ERROR_STREAM_CONNECT_FAILED -1201 47 | #define BRIDGE_ERROR_STREAM_TRANS_FAILED -1202 48 | 49 | /* request related error codes */ 50 | #define BRIDGE_ERROR_REQUEST_FAILED -2101 51 | #define BRIDGE_ERROR_REQUEST_MALFORMED_REPLY -2102 52 | 53 | /*! 54 | * @} 55 | */ 56 | 57 | 58 | /*! \addtogroup BRIDGEDAPI 59 | * @{ 60 | */ 61 | 62 | /*! 63 | * \brief ping bridged daemon 64 | * 65 | * \param conf_file configuration file to use or NULL if default 66 | * 67 | * \retval BRIDGE_SUCCESS success 68 | * \retval BRIDGE_ERROR_STREAM_CONNECT_FAILED connection to servers failed 69 | * \retval BRIDGE_ERROR_STREAM_TRANS_FAILED transmission with server failed 70 | * \retval BRIDGE_ERROR generic error 71 | */ 72 | int 73 | bridgedapi_ping(char* conf_file); 74 | 75 | /*! 76 | * \brief get stats from bridged daemon 77 | * 78 | * \param conf_file configuration file to use or NULL if default 79 | * \param batchid unique identifier of the batch resource to get information of (NULL if not defined) 80 | * \param rmid unique identifier of the resource managed job to get information of (NULL if not defined) 81 | * \param usable pointer on a time_t field that will hold usable time 82 | * \param used pointer on a time_t field that will hold used time 83 | * \param halt pointer on a time_t field that will hold a hypothetic halt time (or 0 if no halt time defined 84 | * 85 | * \retval BRIDGE_SUCCESS success 86 | * \retval BRIDGE_ERROR_REQUEST_FAILED server says it can not give a valid response ( bad batchid or rmid ) 87 | * \retval BRIDGE_ERROR_REQUEST_MALFORMED_REPLY reply is invalid 88 | * \retval BRIDGE_ERROR_STREAM_CONNECT_FAILED connection to servers failed 89 | * \retval BRIDGE_ERROR_STREAM_TRANS_FAILED transmission with server failed 90 | * \retval BRIDGE_ERROR generic error 91 | * 92 | */ 93 | int 94 | bridgedapi_get(char* conf_file,char* batchid,char* rmid, 95 | time_t* usable,time_t* used,time_t* halt); 96 | 97 | /*! 98 | * @} 99 | */ 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /lib/confparse/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir) 2 | 3 | noinst_LTLIBRARIES = libconfig_parsing.la 4 | 5 | libconfig_parsing_la_SOURCES = analyse.h config_parsing.h conf_yacc.h \ 6 | analyse.c config_parsing.c conf_lex.l conf_yacc.y 7 | libconfig_parsing_la_LDFLAGS = $(LIB_LDFLAGS) 8 | -------------------------------------------------------------------------------- /lib/confparse/analyse.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * lib/confparse/analyse.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2005) 5 | * 6 | * Written by : Philippe DENIEL philippe.deniel@cea.fr 7 | * Thomas LEIBOVICI thomas.leibovici@cea.fr 8 | * 9 | * This file is part of Bridge, an abstraction layer to ease batch system and 10 | * resource manager usage in heterogeneous HPC environments. 11 | * 12 | * Bridge is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * Bridge is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with Bridge. If not, see 24 | \*****************************************************************************/ 25 | 26 | /** 27 | * 28 | * \file analyse.h 29 | * \author $Author: leibovic $ 30 | * \date $Date: 2005/04/22 07:42:05 $ 31 | * \version $Revision: 1.3 $ 32 | * \brief Building the syntax tree. 33 | * 34 | * Build the structure that represents a config file. 35 | * 36 | * CVS History : 37 | * 38 | * $Log: analyse.h,v $ 39 | * Revision 1.3 2005/04/22 07:42:05 leibovic 40 | * Adding configuration print function. 41 | * 42 | * Revision 1.2 2005/04/18 10:42:02 leibovic 43 | * Developing config file reading. 44 | * 45 | * Revision 1.1 2005/04/15 15:01:49 leibovic 46 | * Initial version for config file parsing. 47 | * 48 | * 49 | */ 50 | 51 | 52 | #ifndef CONFPARSER_H 53 | #define CONFPARSER_H 54 | 55 | #include 56 | #include 57 | 58 | 59 | #define MAXSTRLEN 1024 60 | 61 | typedef struct _type_affect_ { 62 | char varname[MAXSTRLEN]; 63 | char varvalue[MAXSTRLEN]; 64 | struct _type_affect_ * next; /* chained list */ 65 | }type_affect; 66 | 67 | typedef type_affect * list_affect; 68 | 69 | typedef struct _type_block_ { 70 | 71 | char name[MAXSTRLEN]; 72 | list_affect list_def; /* list of blockk definitions */ 73 | struct _type_block_ * next; /* chained list */ 74 | 75 | } type_block; 76 | 77 | typedef type_block * list_block; 78 | 79 | 80 | /** 81 | * Creation d'une list de blocks 82 | */ 83 | list_block * config_createlistblock(); 84 | 85 | /** 86 | * Creation d'un block 87 | */ 88 | type_block * config_createblock(char * blockname,list_affect * list); 89 | 90 | /** 91 | * Ajout d'un block a une list de blocks 92 | */ 93 | void config_addblock( list_block * list,type_block * block ); 94 | 95 | 96 | /** 97 | * Creation d'une list d'affectations 98 | */ 99 | list_affect * config_createlistaffect(); 100 | 101 | /** 102 | * Creation d'une definition variable=valeur 103 | */ 104 | type_affect * config_createaffect(char * varname,char * varval); 105 | 106 | 107 | /** 108 | * Ajout d'une definition a une list d'affectations 109 | */ 110 | void config_adddef(list_affect * list,type_affect * affect); 111 | 112 | 113 | /** 114 | * Affichage idente du contenu d'une list de blocks. 115 | */ 116 | void config_print_list(FILE * output, list_block * list); 117 | 118 | 119 | /** 120 | * config_free_list: 121 | * libere les ressources utilisees par une liste de blocks. 122 | */ 123 | void config_free_list(list_block * list); 124 | 125 | 126 | 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /lib/confparse/conf_lex.l: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | #include 4 | #include 5 | #include "analyse.h" 6 | #include "conf_yacc.h" 7 | 8 | /* Numero de la ligne courante */ 9 | int yylineno; 10 | 11 | /* Traitement des messages d'erreur */ 12 | void set_error(char * s); 13 | 14 | #define ERRLEN 1024 15 | char err_str[ERRLEN]=""; 16 | 17 | /* Stockage des chaines */ 18 | char YY_PARSED_STRING[MAXSTRLEN+1]; 19 | 20 | void YY_BUFFER_APPEND(char * s){ 21 | strncat( YY_PARSED_STRING,s, MAXSTRLEN); 22 | } 23 | 24 | void YY_BUFFER_RESET(void){ 25 | int i; 26 | for (i=0;i{LETTER}({IDENTIFIER_CHAR})* {/* identifier */ DEBUG_LEX("[bloc:%s]\n",yytext); strncpy(yylval.str_val,yytext,MAXSTRLEN); BEGIN BLOC; return IDENTIFIER;} 66 | 67 | 68 | "{" {/* identifier */ DEBUG_LEX("BEGIN_BLOCK\n",yytext); BEGIN INBLOC;return BEGIN_BLOCK;} 69 | 70 | {LETTER}({IDENTIFIER_CHAR})* {/* identifier */ DEBUG_LEX("[id:%s",yytext);strncpy(yylval.str_val,yytext,MAXSTRLEN); BEGIN AFFECT;return IDENTIFIER;} 71 | "}" {/* identifier */ DEBUG_LEX("END_BLOCK\n",yytext); BEGIN YY_INIT;return END_BLOCK;} 72 | 73 | "=" {/* identifier */ DEBUG_LEX(" , ",yytext); BEGIN VALUE;return AFFECTATION;} 74 | 75 | "\"" {BEGIN STRING1;DEBUG_LEX("value:<");YY_BUFFER_RESET();} /* ouverture string 1 */ 76 | "'" {BEGIN STRING2;DEBUG_LEX("value:<");YY_BUFFER_RESET();} /* ouverture string 2 */ 77 | ({VAL_CHAR})+ {/* valeur */DEBUG_LEX("value:%s",yytext);BEGIN ENDVALUE;strncpy(yylval.str_val,yytext,MAXSTRLEN); return KEYVALUE;} 78 | 79 | ";" {DEBUG_LEX("]\n");BEGIN INBLOC;return END_AFFECT;} 80 | 81 | \\ {BEGIN ESC1;} 82 | "\"" {DEBUG_LEX(">");strncpy(yylval.str_val,YY_PARSED_STRING,MAXSTRLEN);BEGIN ENDVALUE;/* chaine finie */ return KEYVALUE;} 83 | \n {snprintf(err_str,ERRLEN,"line %d: missing closing quote.",yylineno,*yytext); set_error(err_str);yylineno++;return _ERROR_;} 84 | . {YY_BUFFER_APPEND(yytext); DEBUG_LEX("%c",*yytext);/* caractere de la chaine */} 85 | 86 | \n BEGIN STRING1;yylineno++;/* ignore un saut de ligne echappe*/ 87 | . {DEBUG_LEX("%c",*yytext);YY_BUFFER_APPEND(yytext);BEGIN STRING1;/* caractere de la chaine */} 88 | 89 | "'" {DEBUG_LEX(">");strncpy(yylval.str_val,YY_PARSED_STRING,MAXSTRLEN);BEGIN ENDVALUE;/* chaine finie */ return KEYVALUE;} 90 | \n {snprintf(err_str,ERRLEN,"line %d: closing quote missing.",yylineno,*yytext); set_error(err_str);yylineno++;return _ERROR_;} 91 | . {YY_BUFFER_APPEND(yytext);DEBUG_LEX("%c",*yytext);/* caractere de la chaine */} 92 | 93 | {COMMENTAIRE} ;/* ignore */ 94 | {SPACE} ;/* ignore */ 95 | {NL} yylineno++;/* ignore */ 96 | 97 | . { snprintf(err_str,ERRLEN,"line %d: '%c' unexpected",yylineno,*yytext); set_error(err_str);return _ERROR_;} 98 | 99 | %% 100 | 101 | int yywrap(void){ 102 | return 1; 103 | } 104 | -------------------------------------------------------------------------------- /lib/confparse/conf_yacc.h: -------------------------------------------------------------------------------- 1 | /* A Bison parser, made by GNU Bison 1.875c. */ 2 | 3 | /* Skeleton parser for Yacc-like parsing with Bison, 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2, or (at your option) 9 | any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, 19 | Boston, MA 02111-1307, USA. */ 20 | 21 | /* As a special exception, when this file is copied by Bison into a 22 | Bison output file, you may use that output file without restriction. 23 | This special exception was added by the Free Software Foundation 24 | in version 1.24 of Bison. */ 25 | 26 | /* Tokens. */ 27 | #ifndef YYTOKENTYPE 28 | # define YYTOKENTYPE 29 | /* Put the tokens into the symbol table, so that GDB and other debuggers 30 | know about them. */ 31 | enum yytokentype { 32 | _ERROR_ = 258, 33 | BEGIN_BLOCK = 259, 34 | END_BLOCK = 260, 35 | AFFECTATION = 261, 36 | END_AFFECT = 262, 37 | IDENTIFIER = 263, 38 | KEYVALUE = 264 39 | }; 40 | #endif 41 | #define _ERROR_ 258 42 | #define BEGIN_BLOCK 259 43 | #define END_BLOCK 260 44 | #define AFFECTATION 261 45 | #define END_AFFECT 262 46 | #define IDENTIFIER 263 47 | #define KEYVALUE 264 48 | 49 | 50 | 51 | 52 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) 53 | #line 27 "conf_yacc.y" 54 | typedef union YYSTYPE { 55 | char str_val[MAXSTRLEN]; 56 | list_block * listbl; 57 | type_block * block; 58 | list_affect * listaf; 59 | type_affect * affectation; 60 | } YYSTYPE; 61 | /* Line 1275 of yacc.c. */ 62 | #line 63 "conf_yacc.h" 63 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 64 | # define YYSTYPE_IS_DECLARED 1 65 | # define YYSTYPE_IS_TRIVIAL 1 66 | #endif 67 | 68 | extern YYSTYPE yylval; 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /lib/confparse/conf_yacc.y: -------------------------------------------------------------------------------- 1 | %{ 2 | 3 | #include 4 | #include "analyse.h" 5 | 6 | 7 | int yylex(void); 8 | void yyerror(char*); 9 | 10 | list_block * program_result=NULL; 11 | 12 | /* stock le message d'erreur donne par le lexer */ 13 | char local_errormsg[1024]=""; 14 | 15 | /* stock le message d'erreur complet */ 16 | char extern_errormsg[1024]=""; 17 | 18 | #ifdef _DEBUG_PARSING 19 | #define DEBUG_YACK config_print_list 20 | #else 21 | #define DEBUG_YACK 22 | #endif 23 | 24 | 25 | %} 26 | 27 | %union { 28 | char str_val[MAXSTRLEN]; 29 | list_block * listbl; 30 | type_block * block; 31 | list_affect * listaf; 32 | type_affect * affectation; 33 | }; 34 | 35 | %token _ERROR_ 36 | %token BEGIN_BLOCK 37 | %token END_BLOCK 38 | %token AFFECTATION 39 | %token END_AFFECT 40 | %token IDENTIFIER 41 | %token KEYVALUE 42 | 43 | %type listblock 44 | %type definition 45 | %type list_var 46 | %type var 47 | 48 | 49 | %% 50 | 51 | program: listblock {DEBUG_YACK(stderr,$1);program_result=$1;} 52 | ; 53 | 54 | listblock: 55 | definition listblock {config_addblock($2,$1);$$=$2;} 56 | | {$$=config_createlistblock();} 57 | ; 58 | 59 | definition: 60 | IDENTIFIER BEGIN_BLOCK list_var END_BLOCK {$$=config_createblock($1,$3);} 61 | ; 62 | 63 | list_var: 64 | var list_var {config_adddef($2,$1);$$=$2;} 65 | | {$$=config_createlistaffect();} 66 | ; 67 | 68 | var: 69 | IDENTIFIER AFFECTATION KEYVALUE END_AFFECT {$$=config_createaffect($1,$3);} 70 | ; 71 | 72 | %% 73 | 74 | void yyerror(char *s){ 75 | 76 | snprintf(extern_errormsg,1024,"%s (%s)",local_errormsg,s); 77 | 78 | } 79 | 80 | 81 | void set_error(char * s){ 82 | strncpy(local_errormsg,s,1024); 83 | } 84 | -------------------------------------------------------------------------------- /lib/confparse/config_parsing.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * lib/confparse/config_parsing.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2005) 5 | * 6 | * Written by : Philippe DENIEL philippe.deniel@cea.fr 7 | * Thomas LEIBOVICI thomas.leibovici@cea.fr 8 | * 9 | * This file is part of Bridge, an abstraction layer to ease batch system and 10 | * resource manager usage in heterogeneous HPC environments. 11 | * 12 | * Bridge is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * Bridge is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with Bridge. If not, see 24 | \*****************************************************************************/ 25 | 26 | /* 27 | * \file parsing.h 28 | * \author $Author: deniel $ 29 | * \date $Date: 2005/11/28 17:03:22 $ 30 | * \version $Revision: 1.3 $ 31 | * \brief Configuration file parsing routines. 32 | * 33 | * This API is not thread-safe. 34 | * 35 | * CVS History: 36 | * 37 | * $Log: config_parsing.h,v $ 38 | * Revision 1.3 2005/11/28 17:03:22 deniel 39 | * Added CeCILL headers 40 | * 41 | * Revision 1.2 2005/04/22 07:42:20 leibovic 42 | * Adding config_Print. 43 | * 44 | * Revision 1.1 2005/04/18 10:46:30 leibovic 45 | * Interface for config parsing. 46 | * 47 | * Revision 1.1 2005/04/15 15:01:49 leibovic 48 | * Initial version for config file parsing. 49 | * 50 | * 51 | */ 52 | 53 | 54 | #ifndef _CONFIG_PARSING_H 55 | #define _CONFIG_PARSING_H 56 | 57 | #include 58 | #include 59 | 60 | /* opaque type */ 61 | typedef caddr_t config_file_t; 62 | 63 | 64 | /* config_ParseFile: 65 | * Reads the content of a configuration file and 66 | * stores it in a memory structure. 67 | * \return NULL on error. 68 | */ 69 | config_file_t config_ParseFile( char * file_path ); 70 | 71 | 72 | /* If config_ParseFile returns a NULL pointer, 73 | * config_GetErrorMsg returns a detailed message 74 | * to indicate the reason for this error. 75 | */ 76 | char * config_GetErrorMsg(); 77 | 78 | 79 | /** 80 | * config_Print: 81 | * Print the content of the syntax tree 82 | * to a file. 83 | */ 84 | void config_Print( FILE * output, config_file_t config ); 85 | 86 | 87 | 88 | /* Free the memory structure that store the configuration. */ 89 | void config_Free( config_file_t config ); 90 | 91 | 92 | /* Indicates how many blocks are defined into the config file. 93 | * \return A positive value if no error. 94 | * Else return a negative error code. 95 | */ 96 | int config_GetNbBlocks( config_file_t config ); 97 | 98 | 99 | /* Indicates the name of a block (specified with its index). */ 100 | char * config_GetBlockName( config_file_t config , int block_no ); 101 | 102 | 103 | /* Indicates how many peers (key-value) are defined in a block 104 | * (specified with its index). 105 | */ 106 | int config_GetNbKeys( config_file_t config, int block_no ); 107 | 108 | 109 | /* Retrieves a key-value peer from the block index and the key index. */ 110 | int config_GetKeyValue( 111 | config_file_t config, 112 | int block_no, 113 | int key_no, 114 | char ** var_name, 115 | char ** var_value 116 | ); 117 | 118 | 119 | /* Returns the block with the specified name. */ 120 | int config_GetBlockIndexByName( config_file_t config, 121 | char * block_name ); 122 | 123 | 124 | /* Returns the value of the key with the specified name. */ 125 | char * config_GetKeyValueByName( config_file_t config, 126 | int block_no, 127 | char * key_name ); 128 | 129 | 130 | 131 | 132 | 133 | 134 | #endif 135 | -------------------------------------------------------------------------------- /lib/xternal/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir) $(LIBTIRPC_CFLAGS) 2 | 3 | noinst_HEADERS = xerror.h xlogger.h \ 4 | xstream.h xqueue.h \ 5 | xmessage.h xfreelist.h \ 6 | xlibrary.h 7 | 8 | noinst_LTLIBRARIES = libxternal.la 9 | 10 | libxternal_la_CPPFLAGS = -D_THREAD_SAFE -pthread $(LIBTIRPC_CFLAGS) 11 | libxternal_la_SOURCES = xlogger.c xstream.c \ 12 | xmessage.c xqueue.c \ 13 | xfreelist.c xlibrary.c 14 | libxternal_la_LDFLAGS = $(LIB_LDFLAGS) -pthread $(LIBTIRPC_LIBS) 15 | -------------------------------------------------------------------------------- /lib/xternal/xerror.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * lib/xternal/xerror.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | /** 24 | * \file xerror.h 25 | * \author M. Hautreux 26 | * \date 07/29/2008 27 | * \brief External errors code 28 | */ 29 | #ifndef __XERROR_H_ 30 | #define __XERROR_H_ 31 | 32 | 33 | #define XSUCCESS 0 34 | #define XERROR -1 35 | 36 | #define XERROR_EINTR -2 37 | #define XERROR_MEMORY -3 38 | 39 | /* pthread related error code */ 40 | #define XERROR_MUTEX_INIT_FAILED -91 41 | #define XERROR_MUTEX_LOCK_FAILED -92 42 | #define XERROR_CONDITION_INIT_FAILED -93 43 | 44 | /* xfreelist related error codes */ 45 | #define XERROR_FREELIST_INIT_FAILED -101 46 | #define XERROR_FREELIST_IS_EMPTY -102 47 | #define XERROR_FREELIST_ITEM_NOT_FOUND -103 48 | #define XERROR_FREELIST_ITEM_ALREADY_FREE -104 49 | 50 | /* xlibrary related error codes */ 51 | #define XERROR_LIBRARY_ITEM_NOT_FOUND -201 52 | #define XERROR_LIBRARY_OBJECT_NOT_FOUND -202 53 | #define XERROR_LIBRARY_ADD_FAILED -203 54 | 55 | /* xstream related error code */ 56 | #define XERROR_STREAM_SOCKET_FAILED -301 57 | #define XERROR_STREAM_SETSOCKOPT_FAILED -302 58 | #define XERROR_STREAM_GETADDRINFO_FAILED -303 59 | #define XERROR_STREAM_BIND_FAILED -304 60 | #define XERROR_STREAM_CONNECT_FAILED -305 61 | #define XERROR_STREAM_POLL_ERROR -306 62 | #define XERROR_STREAM_TIMEOUT -307 63 | #define XERROR_STREAM_SOCKET_CLOSED -308 64 | #define XERROR_STREAM_WRONG_LENGTH -309 65 | 66 | /* xqueue related error code */ 67 | #define XERROR_QUEUE_FREELIST_IS_NULL -401 68 | #define XERROR_QUEUE_FREELIST_EXTRACT_ITEM -402 69 | #define XERROR_QUEUE_IS_EMPTY -403 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /lib/xternal/xmessage.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * lib/xternal/xmessage.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | /** 24 | * \file xmessage.h 25 | * \author M. Hautreux 26 | * \date 07/01/2008 27 | * \brief External Communication message headers 28 | */ 29 | #ifndef __XMESSAGE_H_ 30 | #define __XMESSAGE_H_ 31 | 32 | /*! \addtogroup XTERNAL 33 | * @{ 34 | */ 35 | 36 | /*! \addtogroup XMESSAGE 37 | * @{ 38 | */ 39 | 40 | /*! 41 | * \enum XMESSAGE_TYPE 42 | */ 43 | enum XMESSAGE_TYPE { 44 | 45 | XPING_REQUEST=0, 46 | XGET_REQUEST, 47 | XEND_REQUEST, 48 | 49 | XERROR_REPLY=20, 50 | XPING_REPLY, 51 | XGET_REPLY, 52 | XACK_REPLY 53 | 54 | }; 55 | 56 | /*! 57 | * \struct xmessage 58 | * \typedef xmessage_t 59 | * \brief external stream communication basic element 60 | */ 61 | typedef struct xmessage { 62 | int type; 63 | size_t length; 64 | void* data; 65 | } xmessage_t; 66 | 67 | /*! 68 | * \fn xmessage_init(xmessage_t* msg,int type,char* buffer,size_t length) 69 | * \brief initialise a xmessage structure 70 | * 71 | * \param msg pointer to the structure to initialise 72 | * \param type type of the message to initialize 73 | * \param buffer message body 74 | * \param length length of the message body 75 | * 76 | * \retval XSUCCESS operation successfully done 77 | * \retval XERROR generic error 78 | * 79 | */ 80 | int 81 | xmessage_init(xmessage_t* msg,int type,char* buffer,size_t length); 82 | 83 | /*! 84 | * \fn xmessage_marshall(xmessage_t* msg,char** pbuffer,size_t* psize) 85 | * \brief marshall an xmessage 86 | * 87 | * \param msg xmessage pointer 88 | * \param pbuffer pointer on a char buffer that will be allocated and store message data 89 | * \param psize newly allocated buffer size 90 | * 91 | * \retval XSUCCESS operation successfully done 92 | * \retval XERROR generic error 93 | * 94 | */ 95 | int 96 | xmessage_marshall(xmessage_t* msg,char** pbuffer,size_t* psize); 97 | 98 | /*! 99 | * \fn xmessage_unmarshall(xmessage_t* msg,char* buffer,size_t size) 100 | * \brief unmarshall a xmessage 101 | * 102 | * \param msg xmessage pointer 103 | * \param buffer marshalled buffer that represent the message 104 | * \param size marshalled buffer size 105 | * 106 | * \retval XSUCCESS operation successfully done 107 | * \retval XERROR generic error 108 | * 109 | */ 110 | int 111 | xmessage_unmarshall(xmessage_t* msg,char* buffer,size_t size); 112 | 113 | /*! 114 | * \fn xmessage_free_contents(xmessage_t* msg) 115 | * \brief free an xmessage structure contents 116 | * 117 | * \param msg pointer to the structure to free its contents 118 | * 119 | * \retval XSUCCESS operation successfully done 120 | * \retval XERROR generic error 121 | * 122 | */ 123 | int 124 | xmessage_free_contents(xmessage_t* msg); 125 | 126 | /*! 127 | * @} 128 | */ 129 | 130 | /*! 131 | * @} 132 | */ 133 | 134 | #endif 135 | -------------------------------------------------------------------------------- /lib/xternal/xqueue.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * lib/xternal/xqueue.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | /** 24 | * \file xqueue.h 25 | * \author M. Hautreux 26 | * \date 07/01/2008 27 | * \brief External queue headers 28 | */ 29 | #ifndef __XQUEUE_H_ 30 | #define __XQUEUE_H_ 31 | 32 | /* xqueue is implemented using a freelist */ 33 | #include "xfreelist.h" 34 | 35 | /* multihtreading support */ 36 | #include 37 | 38 | /*! \addtogroup XTERNAL 39 | * @{ 40 | */ 41 | 42 | /*! \addtogroup XQUEUE 43 | * @{ 44 | */ 45 | 46 | /*! 47 | * \struct xqueue 48 | * \typedef xqueue_t 49 | * \brief External FIFO queue (based on freelist) 50 | */ 51 | typedef struct xqueue { 52 | 53 | xfreelist_t freelist;//!< freelist used for queue elements storage 54 | 55 | xfreelist_item_t* head;//!< first element 56 | xfreelist_item_t* tail;//!< last element 57 | 58 | pthread_mutex_t mutex;//!< mutex for thread safety 59 | pthread_cond_t condition;//!< condition for threads wake up 60 | 61 | } xqueue_t; 62 | 63 | 64 | /*! 65 | * \fn xqueue_init(xqueue_t* queue,unsigned int default_length,size_t item_size) 66 | * \brief create a xqueue 67 | * 68 | * \param queue pointer on the xqueue structure to initialize 69 | * \param default_length queue max number of element 70 | * \param item_size queue 's element size 71 | * 72 | * \retval XSUCCESS init succeed 73 | * \retval XERROR_MUTEX_INIT_FAILED unable to initialize queue mutex 74 | * \retval XERROR_CONDITION_INIT_FAILED unable to initialize queue condition 75 | */ 76 | int 77 | xqueue_init(xqueue_t* queue,unsigned int default_length,size_t item_size); 78 | 79 | /*! 80 | * \fn xqueue_free_contents(xqueue_t* queue) 81 | * \brief free an xqueue contents 82 | * 83 | * \param queue xqueue to free contents of 84 | * 85 | * \retval XSUCCESS success 86 | * \retval XERROR generic error 87 | */ 88 | int 89 | xqueue_free_contents(xqueue_t* queue); 90 | 91 | /*! 92 | * \fn xqueue_enqueue(xqueue_t* queue,void* data,size_t length) 93 | * \brief enqueue an element into the queue 94 | * 95 | * \param queue xqueue to enqueue element in 96 | * \param data pointer on the data to add 97 | * \param length data size 98 | * 99 | * \retval XSUCCESS element successfully enqueued 100 | * \retval XERROR_MUTEX_LOCK_FAILED mutex lock failed 101 | * \retavl XERROR_QUEUE_FREELIST_IS_NULL freelist is null 102 | * \retval XERROR_FREELIST_IS_EMPTY freelist is empty 103 | * \retval XERROR_QUEUE_FREELIST_EXTRACT_ITEM unable to extract qn item from freelist 104 | * 105 | */ 106 | int 107 | xqueue_enqueue(xqueue_t* queue,void* data,size_t length); 108 | 109 | /*! 110 | * \fn xqueue_dequeue(xqueue_t* queue,void* data,size_t length) 111 | * \brief dequeue an element from the queue 112 | * 113 | * \param queue xqueue to dequeue from 114 | * \param data pointer on the element to fill with data 115 | * \param length data size 116 | * 117 | * \retval XSUCCESS element successfully copied and enqueued 118 | * \retval XERROR generic error 119 | * \retval XERROR_QUEUE_IS_EMPTY no more item to dequeue 120 | * \retval XERROR_QUEUE_FREELIST_IS_NULL queue's freelist is NULL 121 | * \retval XERROR_FREELIST_IS_EMPTY queue's freelist is empty 122 | * \retval XERROR_MUTEX_LOCK_FAILED mutex lock failed 123 | */ 124 | int 125 | xqueue_dequeue(xqueue_t* queue,void* data,size_t length); 126 | 127 | int xqueue_get_length(xqueue_t* queue,int* length); 128 | 129 | int xqueue_wait_4_emptiness(xqueue_t* queue); 130 | /*! 131 | * @} 132 | */ 133 | 134 | /*! 135 | * @} 136 | */ 137 | 138 | #endif 139 | -------------------------------------------------------------------------------- /m4/bridge.m4: -------------------------------------------------------------------------------- 1 | 2 | AC_DEFUN([AX_BRIDGE], 3 | [ 4 | 5 | BRIDGE_BINDING=none 6 | AC_SUBST(BRIDGE_BINDING) 7 | 8 | BRIDGE_BATCH_SYSTEM=none 9 | AC_SUBST([BRIDGE_BATCH_SYSTEM]) 10 | BRIDGE_BATCH_PLUGIN=none 11 | AC_SUBST([BRIDGE_BATCH_PLUGIN]) 12 | 13 | BRIDGE_RM_SYSTEM=none 14 | AC_SUBST([BRIDGE_RM_SYSTEM]) 15 | BRIDGE_RM_PLUGIN=none 16 | AC_SUBST([BRIDGE_RM_PLUGIN]) 17 | 18 | ]) 19 | -------------------------------------------------------------------------------- /m4/lsf.m4: -------------------------------------------------------------------------------- 1 | 2 | AC_DEFUN([AX_LSF], 3 | [ 4 | 5 | saved_CPPFLAGS="$CPPFLAGS" 6 | saved_LDFLAGS="$LDFLAGS" 7 | 8 | ac_have_lsf=no 9 | 10 | AC_ARG_WITH(lsf, 11 | AS_HELP_STRING(--with-lsf@<:@=PATH@:>@ ,Specify LSF support and path), 12 | [ ac_have_lsf=yes; LSFDIR="$withval" ] 13 | ) 14 | AC_ARG_WITH(lsf-lib, 15 | AS_HELP_STRING(--with-lsf-lib@<:@=PATH@:>@,Specify LSF libraries path), 16 | [ LSFLIBDIR="$withval" ] 17 | ) 18 | 19 | if test "x$ac_have_lsf" == "xyes" ; then 20 | 21 | dnl extend CPPFLAGS and LDFLAGS if required 22 | if test "x$LSFDIR" != "x" && test "x$LSFDIR" != "xyes" ; then 23 | LSF_CPPFLAGS="-I$LSFDIR/include" 24 | CPPFLAGS="${CPPFLAGS} ${LSF_CPPFLAGS}" 25 | LSF_LDFLAGS="-L$LSFDIR/lib -lnsl" 26 | LDFLAGS="$LDFLAGS $LSF_LDFLAGS" 27 | fi 28 | if test "x$LSFLIBDIR" != "x" && test "x$LSFLIBDIR" != "xyes" ; then 29 | LSF_LDFLAGS="-L$LSFLIBDIR -lnsl" 30 | LDFLAGS="$LDFLAGS $LSF_LDFLAGS" 31 | fi 32 | 33 | dnl check for headers 34 | AC_CHECK_HEADERS([lsf/lsf.h],[has_lsf_header="true"]) 35 | if test "x$has_lsf_header" != "xtrue" ; then 36 | AC_MSG_ERROR([unable to use LSF without lsf/lsf.h]) 37 | fi 38 | AC_CHECK_HEADERS([lsf/lsbatch.h],[has_lsbatch_header="true"]) 39 | if test "x$has_lsbatch_header" != "xtrue" ; then 40 | AC_MSG_ERROR([unable to use LSF without lsf/lsbatch.h]) 41 | fi 42 | 43 | dnl check for libraries 44 | AC_CHECK_LIB([lsf],[ls_connect],[has_lsf_lib="yes"],[has_lsf_lib="no"]) 45 | if test "x$has_lsf_lib" != "xyes" ; then 46 | AC_MSG_ERROR([unable to use LSF without liblsf]) 47 | else 48 | LSF_LDFLAGS="${LSF_LDFLAGS} -llsf -lbat" 49 | LDFLAGS="$LDFLAGS -llsf -lbat" 50 | fi 51 | 52 | dnl set batch system name and plugin 53 | dnl then set batch_system<->rm_system binding method 54 | dnl (used during configuration files creation) 55 | BRIDGE_BATCH_SYSTEM=lsf 56 | AC_SUBST([BRIDGE_BATCH_SYSTEM]) 57 | BRIDGE_BATCH_PLUGIN=libbridge_bs_lsf.so 58 | AC_SUBST([BRIDGE_BATCH_PLUGIN]) 59 | BRIDGE_BINDING=none 60 | AC_SUBST([BRIDGE_BINDING]) 61 | 62 | dnl set resource management system if not already done 63 | if test "x$BRIDGE_RM_SYSTEM" != "x" ; then 64 | BRIDGE_RM_SYSTEM=lsf 65 | AC_SUBST([BRIDGE_RM_SYSTEM]) 66 | fi 67 | 68 | fi 69 | 70 | CPPFLAGS="$saved_CPPFLAGS" 71 | LDFLAGS="$saved_LDFLAGS" 72 | 73 | AC_SUBST([LSF_CPPFLAGS]) 74 | AC_SUBST([LSF_LDFLAGS]) 75 | 76 | AM_CONDITIONAL(HAVE_LSF, test "x$ac_have_lsf" = "xyes") 77 | AC_SUBST(HAVE_LSF) 78 | 79 | ]) 80 | 81 | AC_DEFUN([AX_LSF_SLURM], 82 | [ 83 | saved_CPPFLAGS="$CPPFLAGS" 84 | saved_LDFLAGS="$LDFLAGS" 85 | 86 | ac_have_lsf_slurm=no 87 | 88 | AC_ARG_WITH(lsf-slurm, 89 | AS_HELP_STRING(--with-lsf-slurm,Specify LSF with Slurm binding support), 90 | [ ac_have_lsf_slurm=yes ] 91 | ) 92 | 93 | if test "x$ac_have_lsf_slurm" == "xyes" ; then 94 | 95 | if test "x$ac_have_lsf" != "xyes" ; then 96 | AX_LSF 97 | fi 98 | if test "x$ac_have_lsf" != "xyes" ; then 99 | AC_MSG_ERROR([unable to use LSF-Slurm without LSF]) 100 | else 101 | CPPFLAGS="${CPPFLAGS} ${LSF_CPPFLAGS}" 102 | LDFLAGS="${LDFLAGS} ${LSF_LDFLAGS}" 103 | 104 | dnl check for headers 105 | AC_CHECK_HEADERS([lsf/openlsfslurm.h],[has_openlsfslurm_header="true"]) 106 | if test "x$has_openlsfslurm_header" != "xtrue" ; then 107 | AC_MSG_ERROR([unable to use LSF-Slurm without lsf/openlsfslurm.h]) 108 | fi 109 | 110 | dnl check for libraries 111 | AC_CHECK_LIB([openlsfslurm],[slurm_run],[has_openlsfslurm_lib="yes"],[has_openlsfslurm_lib="no"]) 112 | if test "x$has_openlsfslurm_lib" != "xyes" ; then 113 | AC_MSG_ERROR([unable to use LSF-Slurm without libopenlsfslurm]) 114 | else 115 | ac_have_lsf_slurm=yes 116 | fi 117 | 118 | dnl with lsf-slurm, we use lsf rmid value for Batch_system<->Rm_system binding 119 | dnl we also use a different batch system plugin 120 | dnl (used during configuration files creation) 121 | BRIDGE_BINDING=rmid 122 | AC_SUBST([BRIDGE_BINDING]) 123 | BRIDGE_BATCH_PLUGIN=libbridge_bs_lsf_slurm.so 124 | AC_SUBST([BRIDGE_BATCH_PLUGIN]) 125 | 126 | fi 127 | 128 | fi 129 | 130 | CPPFLAGS="$saved_CPPFLAGS" 131 | LDFLAGS="$saved_LDFLAGS" 132 | 133 | AM_CONDITIONAL(HAVE_LSF_SLURM, test "x$ac_have_lsf_slurm" = "xyes") 134 | AC_SUBST(HAVE_LSF_SLURM) 135 | 136 | ]) 137 | -------------------------------------------------------------------------------- /m4/ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software 4 | # Foundation, Inc. 5 | # Written by Gary V. Vaughan, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 6 ltsugar.m4 12 | 13 | # This is to help aclocal find these macros, as it can't see m4_define. 14 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 15 | 16 | 17 | # lt_join(SEP, ARG1, [ARG2...]) 18 | # ----------------------------- 19 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 20 | # associated separator. 21 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 22 | # versions in m4sugar had bugs. 23 | m4_define([lt_join], 24 | [m4_if([$#], [1], [], 25 | [$#], [2], [[$2]], 26 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 27 | m4_define([_lt_join], 28 | [m4_if([$#$2], [2], [], 29 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 30 | 31 | 32 | # lt_car(LIST) 33 | # lt_cdr(LIST) 34 | # ------------ 35 | # Manipulate m4 lists. 36 | # These macros are necessary as long as will still need to support 37 | # Autoconf-2.59, which quotes differently. 38 | m4_define([lt_car], [[$1]]) 39 | m4_define([lt_cdr], 40 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 41 | [$#], 1, [], 42 | [m4_dquote(m4_shift($@))])]) 43 | m4_define([lt_unquote], $1) 44 | 45 | 46 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 47 | # ------------------------------------------ 48 | # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. 49 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 50 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 51 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 52 | # than defined and empty). 53 | # 54 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 55 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 56 | m4_define([lt_append], 57 | [m4_define([$1], 58 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 59 | 60 | 61 | 62 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 63 | # ---------------------------------------------------------- 64 | # Produce a SEP delimited list of all paired combinations of elements of 65 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 66 | # has the form PREFIXmINFIXSUFFIXn. 67 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 68 | m4_define([lt_combine], 69 | [m4_if(m4_eval([$# > 3]), [1], 70 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 71 | [[m4_foreach([_Lt_prefix], [$2], 72 | [m4_foreach([_Lt_suffix], 73 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 74 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 75 | 76 | 77 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 78 | # ----------------------------------------------------------------------- 79 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 80 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 81 | m4_define([lt_if_append_uniq], 82 | [m4_ifdef([$1], 83 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 84 | [lt_append([$1], [$2], [$3])$4], 85 | [$5])], 86 | [lt_append([$1], [$2], [$3])$4])]) 87 | 88 | 89 | # lt_dict_add(DICT, KEY, VALUE) 90 | # ----------------------------- 91 | m4_define([lt_dict_add], 92 | [m4_define([$1($2)], [$3])]) 93 | 94 | 95 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 96 | # -------------------------------------------- 97 | m4_define([lt_dict_add_subkey], 98 | [m4_define([$1($2:$3)], [$4])]) 99 | 100 | 101 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 102 | # ---------------------------------- 103 | m4_define([lt_dict_fetch], 104 | [m4_ifval([$3], 105 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 106 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 107 | 108 | 109 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 110 | # ----------------------------------------------------------------- 111 | m4_define([lt_if_dict_fetch], 112 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 113 | [$5], 114 | [$6])]) 115 | 116 | 117 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 118 | # -------------------------------------------------------------- 119 | m4_define([lt_dict_filter], 120 | [m4_if([$5], [], [], 121 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 122 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 123 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 124 | ]) 125 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 4179 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.6]) 16 | m4_define([LT_PACKAGE_REVISION], [2.4.6]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.6' 20 | macro_revision='2.4.6' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /m4/nqsII.m4: -------------------------------------------------------------------------------- 1 | 2 | AC_DEFUN([AX_NQSII], 3 | [ 4 | 5 | saved_CPPFLAGS="$CPPFLAGS" 6 | saved_LDFLAGS="$LDFLAGS" 7 | 8 | ac_have_nqsII=no 9 | 10 | AC_ARG_WITH(nqsII, 11 | AS_HELP_STRING(--with-nqsII@<:@=PATH@:>@,Specify NQSII support and path), 12 | [ ac_have_nqsII=yes; NQSIIDIR="$withval" ] 13 | ) 14 | AC_ARG_WITH(nqsII-lib, 15 | AS_HELP_STRING(--with-nqsII-lib@<:@=PATH@:>@,Specify NQSII libraries path), 16 | [ NQSIILIBDIR="$withval" ] 17 | ) 18 | 19 | if test "x$ac_have_nqsII" == "xyes" ; then 20 | 21 | dnl extend CPPFLAGS and LDFLAGS if required 22 | if test "x$NQSIIDIR" != "x" && test "x$NQSIIDIR" != "xyes" ; then 23 | NQSII_CPPFLAGS="-I$NQSIIDIR/include" 24 | CPPFLAGS="${CPPFLAGS} ${NQSII_CPPFLAGS}" 25 | NQSII_LDFLAGS="-L$NQSIIDIR/lib" 26 | LDFLAGS="$LDFLAGS $NQSII_LDFLAGS" 27 | fi 28 | if test "x$NQSIILIBDIR" != "x" && test "x$NQSIILIBDIR" != "xyes" ; then 29 | NQSII_LDFLAGS="-L$NQSIILIBDIR" 30 | LDFLAGS="$LDFLAGS $NQSII_LDFLAGS" 31 | fi 32 | 33 | dnl check for headers 34 | AC_CHECK_HEADERS([nqsII.h],[has_nqsII_header="true"]) 35 | if test "x$has_nqsII_header" != "xtrue" ; then 36 | AC_MSG_ERROR([unable to use NQSII without nqsII.h]) 37 | fi 38 | 39 | dnl check for libraries 40 | AC_CHECK_LIB([nqsII],[NQSconnect],[has_nqsII_lib="yes"],[has_nqsII_lib="no"]) 41 | if test "x$has_nqsII_lib" != "xyes" ; then 42 | AC_MSG_ERROR([unable to use NQSII without libnqsII]) 43 | else 44 | NQSII_LDFLAGS="${NQSII_LDFLAGS} -lnqsII" 45 | LDFLAGS="$LDFLAGS -lnqsII" 46 | fi 47 | 48 | dnl set batch system name and plugin 49 | dnl then set batch_system<->rm_system binding method 50 | dnl (used during configuration files creation) 51 | BRIDGE_BATCH_SYSTEM=nqsII 52 | AC_SUBST([BRIDGE_BATCH_SYSTEM]) 53 | BRIDGE_BATCH_PLUGIN=libbridge_bs_nqsII.so 54 | AC_SUBST([BRIDGE_BATCH_PLUGIN]) 55 | BRIDGE_RM_SYSTEM=nqsII 56 | AC_SUBST([BRIDGE_RM_SYSTEM]) 57 | BRIDGE_RM_PLUGIN=libbridge_bs_nqsII.so 58 | AC_SUBST([BRIDGE_RM_PLUGIN]) 59 | BRIDGE_BINDING=none 60 | AC_SUBST([BRIDGE_BINDING]) 61 | 62 | fi 63 | 64 | CPPFLAGS="$saved_CPPFLAGS" 65 | LDFLAGS="$saved_LDFLAGS" 66 | 67 | AC_SUBST([NQSII_CPPFLAGS]) 68 | AC_SUBST([NQSII_LDFLAGS]) 69 | 70 | AM_CONDITIONAL(HAVE_NQSII, test "x$ac_have_nqsII" = "xyes") 71 | AC_SUBST(HAVE_NQSII) 72 | 73 | ]) 74 | -------------------------------------------------------------------------------- /m4/slurm.m4: -------------------------------------------------------------------------------- 1 | 2 | AC_DEFUN([AX_SLURM], 3 | [ 4 | 5 | saved_CPPFLAGS="$CPPFLAGS" 6 | saved_LDFLAGS="$LDFLAGS" 7 | 8 | ac_have_slurm=no 9 | 10 | AC_ARG_WITH(slurm, 11 | AS_HELP_STRING(--with-slurm@<:@=PATH@:>@,Specify SLURM support and path), 12 | [ ac_have_slurm=yes; SLURMDIR="$withval" ] 13 | ) 14 | AC_ARG_WITH(slurm-lib, 15 | AS_HELP_STRING(--with-slurm-lib@<:@=PATH@:>@,Specify SLURM libraries path), 16 | [ SLURMLIBDIR="$withval" ] 17 | ) 18 | 19 | if test "x$ac_have_slurm" == "xyes" ; then 20 | 21 | SLURM_CPPFLAGS= 22 | SLURM_LDFLAGS= 23 | 24 | dnl extend CPPFLAGS and LDFLAGS if required 25 | if test "x$SLURMDIR" != "x" && test "x$SLURMDIR" != "xyes" ; then 26 | SLURM_CPPFLAGS="-I$SLURMDIR/include" 27 | CPPFLAGS="${CPPFLAGS} ${SLURM_CPPFLAGS}" 28 | SLURM_LDFLAGS="-L$SLURMDIR/lib" 29 | LDFLAGS="$LDFLAGS $SLURM_LDFLAGS" 30 | fi 31 | if test "x$SLURMLIBDIR" != "x" && test "x$SLURMLIBDIR" != "xyes" ; then 32 | SLURM_LDFLAGS="-L$SLURMLIBDIR" 33 | LDFLAGS="$LDFLAGS $SLURM_LDFLAGS" 34 | fi 35 | 36 | dnl check for headers 37 | AC_CHECK_HEADERS([slurm/slurm.h],[has_slurm_header="true"]) 38 | if test "x$has_slurm_header" != "xtrue" ; then 39 | AC_MSG_ERROR([unable to use SLURM without slurm/slurm.h]) 40 | fi 41 | 42 | dnl check for libraries 43 | AC_CHECK_LIB([slurm],[slurm_api_version],[has_slurm_lib="yes"],[has_slurm_lib="no"]) 44 | if test "x$has_slurm_lib" != "xyes" ; then 45 | AC_MSG_ERROR([unable to use SLURM without libslurm]) 46 | else 47 | SLURM_LDFLAGS="${SLURM_LDFLAGS} -lslurm -L../../../lib/bridge/.libs -lbridge" 48 | LDFLAGS="$LDFLAGS -lslurm -L../../../lib/bridge/.libs -lbridge" 49 | 50 | dnl set resource management system name and plugin 51 | dnl (used during configuration files creation) 52 | BRIDGE_RM_SYSTEM=slurm 53 | AC_SUBST([BRIDGE_RM_SYSTEM]) 54 | BRIDGE_RM_PLUGIN=libbridge_rm_slurm.so 55 | AC_SUBST([BRIDGE_RM_PLUGIN]) 56 | 57 | dnl set batch system name if not already set 58 | dnl (used during configuration files creation) 59 | if test "x$BRIDGE_BATCH_SYSTEM" == "xnone" ; then 60 | BRIDGE_BATCH_SYSTEM=slurm 61 | AC_SUBST([BRIDGE_BATCH_SYSTEM]) 62 | BRIDGE_BATCH_PLUGIN=libbridge_bs_slurm.so 63 | AC_SUBST([BRIDGE_BATCH_PLUGIN]) 64 | fi 65 | 66 | fi 67 | 68 | fi 69 | 70 | CPPFLAGS="$saved_CPPFLAGS" 71 | LDFLAGS="$saved_LDFLAGS" 72 | 73 | AC_SUBST([SLURM_CPPFLAGS]) 74 | AC_SUBST([SLURM_LDFLAGS]) 75 | 76 | AM_CONDITIONAL(HAVE_SLURM, test "x$ac_have_slurm" = "xyes") 77 | AC_SUBST(HAVE_SLURM) 78 | 79 | ]) 80 | -------------------------------------------------------------------------------- /m4/torque.m4: -------------------------------------------------------------------------------- 1 | 2 | AC_DEFUN([AX_TORQUE], 3 | [ 4 | 5 | saved_CPPFLAGS="$CPPFLAGS" 6 | saved_LDFLAGS="$LDFLAGS" 7 | 8 | ac_have_torque=no 9 | 10 | AC_ARG_WITH(torque, 11 | AS_HELP_STRING(--with-torque@<:@=PATH@:>@ ,Specify TORQUE support and path), 12 | [ ac_have_torque=yes; TORQUEDIR="$withval" ] 13 | ) 14 | AC_ARG_WITH(torque-lib, 15 | AS_HELP_STRING(--with-torque-lib@<:@=PATH@:>@,Specify TORQUE libraries path), 16 | [ TORQUELIBDIR="$withval" ] 17 | ) 18 | 19 | if test "x$ac_have_torque" == "xyes" ; then 20 | 21 | dnl extend CPPFLAGS and LDFLAGS if required 22 | if test "x$TORQUEDIR" != "x" && test "x$TORQUEDIR" != "xyes" ; then 23 | TORQUE_CPPFLAGS="-I$TORQUEDIR/include" 24 | CPPFLAGS="${CPPFLAGS} ${TORQUE_CPPFLAGS}" 25 | TORQUE_LDFLAGS="-L$TORQUEDIR/lib" 26 | LDFLAGS="$LDFLAGS $TORQUE_LDFLAGS" 27 | fi 28 | if test "x$TORQUELIBDIR" != "x" && test "x$TORQUELIBDIR" != "xyes" ; then 29 | TORQUE_LDFLAGS="-L$TORQUELIBDIR" 30 | LDFLAGS="$LDFLAGS $TORQUE_LDFLAGS" 31 | fi 32 | 33 | dnl check for headers 34 | AC_CHECK_HEADERS([pbs_ifl.h],[has_torque_header="true"]) 35 | if test "x$has_torque_header" != "xtrue" ; then 36 | AC_MSG_ERROR([unable to use TORQUE without pbs_ifl.h]) 37 | fi 38 | dnl check for headers 39 | AC_CHECK_HEADERS([pbs_error.h],[has_torque_header="true"]) 40 | if test "x$has_torque_header" != "xtrue" ; then 41 | AC_MSG_ERROR([unable to use TORQUE without pbs_error.h]) 42 | fi 43 | 44 | dnl check for libraries 45 | AC_CHECK_LIB([torque],[pbs_connect],[has_torque_lib="yes"],[has_torque_lib="no"]) 46 | if test "x$has_torque_lib" != "xyes" ; then 47 | AC_MSG_ERROR([unable to use TORQUE without libtorque]) 48 | else 49 | TORQUE_LDFLAGS="${TORQUE_LDFLAGS} -ltorque" 50 | LDFLAGS="$LDFLAGS -ltorque" 51 | fi 52 | 53 | dnl set batch system name and plugin 54 | dnl then set batch_system<->rm_system binding method 55 | dnl (used during configuration files creation) 56 | BRIDGE_BATCH_SYSTEM=torque 57 | AC_SUBST([BRIDGE_BATCH_SYSTEM]) 58 | BRIDGE_BATCH_PLUGIN=libbridge_bs_torque.so 59 | AC_SUBST([BRIDGE_BATCH_PLUGIN]) 60 | BRIDGE_BINDING=none 61 | AC_SUBST([BRIDGE_BINDING]) 62 | 63 | dnl set resource management system name 64 | BRIDGE_RM_SYSTEM=torque 65 | AC_SUBST([BRIDGE_RM_SYSTEM]) 66 | 67 | fi 68 | 69 | CPPFLAGS="$saved_CPPFLAGS" 70 | LDFLAGS="$saved_LDFLAGS" 71 | 72 | AC_SUBST([TORQUE_CPPFLAGS]) 73 | AC_SUBST([TORQUE_LDFLAGS]) 74 | 75 | AM_CONDITIONAL(HAVE_TORQUE, test "x$ac_have_torque" = "xyes") 76 | AC_SUBST(HAVE_TORQUE) 77 | 78 | ]) 79 | 80 | -------------------------------------------------------------------------------- /plugins/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = batch rm 2 | -------------------------------------------------------------------------------- /plugins/batch/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = lsf_slurm torque slurm lsf 2 | -------------------------------------------------------------------------------- /plugins/batch/lsf/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | # LSF_*FLAGS are got from m4 macro 4 | 5 | if !HAVE_LSF_SLURM 6 | if HAVE_LSF 7 | 8 | PLUGIN_FLAGS = 9 | 10 | AM_CPPFLAGS = $(LSF_CPPFLAGS) -I$(top_srcdir)/lib -g 11 | 12 | lib_LTLIBRARIES = libbridge_bs_lsf.la 13 | libbridge_bs_lsf_la_SOURCES = lsf_batch_manager.c lsf_batch_node.c lsf_batch_queue.c lsf_batch_session.c 14 | libbridge_bs_lsf_la_LIBADD = $(LSF_LDFLAGS) -lm 15 | libbridge_bs_lsf_la_LDFLAGS = -module -avoid-version --export-dynamic 16 | 17 | 18 | endif # HAVE_SLURM 19 | endif # !HAVE_LSF_SLURM 20 | -------------------------------------------------------------------------------- /plugins/batch/lsf/lsf_batch_manager.c: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * plugins/batch/lsf/lsf_batch_manager.c - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #include "config.h" 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #include "bridge/bridge.h" 34 | 35 | #define DEBUG_LOGGER xdebug 36 | #define DEBUG2_LOGGER xdebug2 37 | #define DEBUG3_LOGGER xdebug3 38 | #define ERROR_LOGGER xerror 39 | 40 | #include 41 | 42 | int init_batch_manager(bridge_batch_manager_t* p_batch_manager){ 43 | int fstatus=-1; 44 | 45 | char* cluster_name; 46 | char* master_name; 47 | 48 | p_batch_manager->cluster=NULL; 49 | p_batch_manager->master=NULL; 50 | p_batch_manager->masters_list=NULL; 51 | p_batch_manager->description=NULL; 52 | p_batch_manager->type=NULL; 53 | p_batch_manager->version=NULL; 54 | 55 | cluster_name=ls_getclustername(); 56 | if(cluster_name){ 57 | master_name=ls_getmastername(); 58 | if(master_name){ 59 | p_batch_manager->cluster=strdup(cluster_name); 60 | p_batch_manager->master=strdup(master_name); 61 | p_batch_manager->masters_list=NULL; 62 | p_batch_manager->type=strdup("LSF"); 63 | p_batch_manager->description=strdup("Platform LSF"); 64 | p_batch_manager->version=strdup(LSF_CURRENT_VERSION); 65 | } 66 | fstatus=1; 67 | } 68 | else{ 69 | fstatus=1; 70 | } 71 | 72 | if(check_batch_manager_validity(p_batch_manager)==0){ 73 | lsb_init(NULL); 74 | fstatus=0; 75 | } 76 | else 77 | clean_batch_manager(p_batch_manager); 78 | 79 | return fstatus; 80 | } 81 | 82 | 83 | int 84 | check_batch_manager_validity(bridge_batch_manager_t* p_batch_manager){ 85 | int fstatus=-1; 86 | 87 | if( 88 | p_batch_manager->cluster && 89 | p_batch_manager->master && 90 | p_batch_manager->description && 91 | p_batch_manager->type && 92 | p_batch_manager->version 93 | ) 94 | fstatus=0; 95 | 96 | return fstatus; 97 | } 98 | 99 | 100 | int clean_batch_manager(bridge_batch_manager_t* p_batch_manager){ 101 | int fstatus=-1; 102 | 103 | xfree(p_batch_manager->cluster); 104 | xfree(p_batch_manager->master); 105 | xfree(p_batch_manager->description); 106 | xfree(p_batch_manager->type); 107 | xfree(p_batch_manager->version); 108 | xfree(p_batch_manager->masters_list); 109 | 110 | fstatus=0; 111 | 112 | return fstatus; 113 | } 114 | 115 | int get_batch_id(char** id) { 116 | int fstatus=-1; 117 | 118 | char* bs_id = getenv("LSB_JOBID"); 119 | 120 | if ( bs_id != NULL ) { 121 | *id = strdup(bs_id); 122 | 123 | if ( *id != NULL ) 124 | fstatus=0; 125 | } 126 | 127 | return fstatus; 128 | } 129 | -------------------------------------------------------------------------------- /plugins/batch/lsf_slurm/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | # LSF_*FLAGS are got from m4 macro 4 | 5 | if HAVE_LSF_SLURM 6 | 7 | PLUGIN_FLAGS = 8 | 9 | AM_CPPFLAGS = $(LSF_CPPFLAGS) -I$(top_srcdir)/lib -g 10 | 11 | lib_LTLIBRARIES = libbridge_bs_lsf_slurm.la 12 | libbridge_bs_lsf_slurm_la_SOURCES = lsf_batch_manager.c lsf_batch_node.c lsf_batch_queue.c lsf_batch_session.c 13 | libbridge_bs_lsf_slurm_la_LIBADD = $(LSF_LDFLAGS) -lm 14 | libbridge_bs_lsf_slurm_la_LDFLAGS = -module -avoid-version --export-dynamic 15 | 16 | 17 | endif # HAVE_SLURM 18 | -------------------------------------------------------------------------------- /plugins/batch/lsf_slurm/lsf_batch_manager.c: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * plugins/batch/lsf_slurm/lsf_batch_manager.c - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #include "config.h" 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #include "bridge/bridge.h" 34 | 35 | #define DEBUG_LOGGER debug 36 | #define DEBUG2_LOGGER debug2 37 | #define DEBUG3_LOGGER debug3 38 | #define ERROR_LOGGER error 39 | 40 | #include 41 | 42 | int init_batch_manager(bridge_batch_manager_t* p_batch_manager){ 43 | int fstatus=-1; 44 | 45 | char* cluster_name; 46 | char* master_name; 47 | 48 | p_batch_manager->cluster=NULL; 49 | p_batch_manager->master=NULL; 50 | p_batch_manager->masters_list=NULL; 51 | p_batch_manager->description=NULL; 52 | p_batch_manager->type=NULL; 53 | p_batch_manager->version=NULL; 54 | 55 | cluster_name=ls_getclustername(); 56 | if(cluster_name){ 57 | master_name=ls_getmastername(); 58 | if(master_name){ 59 | p_batch_manager->cluster=strdup(cluster_name); 60 | p_batch_manager->master=strdup(master_name); 61 | p_batch_manager->masters_list=NULL; 62 | p_batch_manager->type=strdup("LSF"); 63 | p_batch_manager->description=strdup("Platform LSF"); 64 | p_batch_manager->version=strdup(LSF_CURRENT_VERSION); 65 | } 66 | fstatus=1; 67 | } 68 | else{ 69 | fstatus=1; 70 | } 71 | 72 | if(check_batch_manager_validity(p_batch_manager)==0){ 73 | lsb_init(NULL); 74 | fstatus=0; 75 | } 76 | else 77 | clean_batch_manager(p_batch_manager); 78 | 79 | return fstatus; 80 | } 81 | 82 | 83 | int 84 | check_batch_manager_validity(bridge_batch_manager_t* p_batch_manager){ 85 | int fstatus=-1; 86 | 87 | if( 88 | p_batch_manager->cluster && 89 | p_batch_manager->master && 90 | p_batch_manager->description && 91 | p_batch_manager->type && 92 | p_batch_manager->version 93 | ) 94 | fstatus=0; 95 | 96 | return fstatus; 97 | } 98 | 99 | 100 | int clean_batch_manager(bridge_batch_manager_t* p_batch_manager){ 101 | int fstatus=-1; 102 | 103 | xfree(p_batch_manager->cluster); 104 | xfree(p_batch_manager->master); 105 | xfree(p_batch_manager->description); 106 | xfree(p_batch_manager->type); 107 | xfree(p_batch_manager->version); 108 | xfree(p_batch_manager->masters_list); 109 | 110 | fstatus=0; 111 | 112 | return fstatus; 113 | } 114 | 115 | int get_batch_id(char** id) { 116 | int fstatus=-1; 117 | 118 | char* bs_id = getenv("LSB_JOBID"); 119 | 120 | if ( bs_id != NULL ) { 121 | *id = strdup(bs_id); 122 | 123 | if ( *id != NULL ) 124 | fstatus=0; 125 | } 126 | 127 | return fstatus; 128 | } 129 | -------------------------------------------------------------------------------- /plugins/batch/slurm/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | # SLURM_*FLAGS are got from m4 macro 4 | 5 | if !HAVE_LSF_SLURM 6 | if HAVE_SLURM 7 | 8 | PLUGIN_FLAGS = 9 | 10 | AM_CPPFLAGS = $(SLURM_CPPFLAGS) -I$(top_srcdir)/lib -g 11 | 12 | lib_LTLIBRARIES = libbridge_bs_slurm.la 13 | libbridge_bs_slurm_la_SOURCES = batch_manager.c batch_node.c batch_queue.c \ 14 | batch_session.c batch_common.c batch_common.h 15 | libbridge_bs_slurm_la_LDFLAGS = -module -avoid-version \ 16 | --export-dynamic $(SLURM_LDFLAGS) 17 | 18 | endif # HAVE_SLURM 19 | endif # !HAVE_LSF_SLURM 20 | -------------------------------------------------------------------------------- /plugins/batch/slurm/batch_common.c: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * plugins/batch/slurm/batch_common.c - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #include "config.h" 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | #include "batch_common.h" 37 | 38 | #define DEBUG_LOGGER debug 39 | #define DEBUG2_LOGGER debug2 40 | #define DEBUG3_LOGGER debug3 41 | #define ERROR_LOGGER error 42 | 43 | int extract_field(char* statusline,char* header,char** field) 44 | { 45 | char* p; 46 | char* e; 47 | 48 | size_t s; 49 | 50 | p = strstr(statusline,header); 51 | 52 | if ( p != NULL ) { 53 | p+= strlen(header); 54 | e = strchr(p,','); 55 | if ( e == NULL ) 56 | *field = strdup(p); 57 | else { 58 | s = (size_t) (e-p); 59 | *field = (char*) malloc ( (s+1) * sizeof(char) ); 60 | memcpy(*field,p,s); 61 | (*field)[s]='\0'; 62 | } 63 | return 0; 64 | } 65 | 66 | return 1; 67 | } 68 | 69 | int extract_mem(char* statusline,char* header,uint32_t* i) 70 | { 71 | int fstatus; 72 | char* field; 73 | 74 | if ( extract_field(statusline,header,&field) == 0 ) { 75 | fstatus = convert_mem(field,i); 76 | free(field); 77 | return fstatus; 78 | } 79 | 80 | return 1; 81 | } 82 | 83 | int extract_float(char* statusline,char* header,float* load) 84 | { 85 | char* field; 86 | 87 | if ( extract_field(statusline,header,&field) == 0 ) { 88 | sscanf(field,"%f",load); 89 | free(field); 90 | return 0; 91 | } 92 | 93 | return 1; 94 | 95 | } 96 | 97 | int extract_cores(char* line,uint32_t* i) 98 | { 99 | 100 | char* boe; 101 | char* noe; 102 | char* moe; 103 | char* eoe; 104 | char c,d = '\0'; 105 | 106 | uint32_t core; 107 | uint32_t node; 108 | uint32_t total; 109 | 110 | total=0; 111 | 112 | boe=line; 113 | 114 | /* a line is elt[,elt]* */ 115 | /* elt is node_nb[:...]* ppn=core_nb */ 116 | while ( boe != NULL ) { 117 | 118 | node=0; 119 | core=1; 120 | 121 | /* get nodes nb */ 122 | eoe=boe; 123 | while ( isdigit(*eoe) ) 124 | eoe++; 125 | c=*eoe; 126 | *eoe='\0'; 127 | sscanf(boe,"%d",&node); 128 | *eoe=c; 129 | 130 | /* search the end of the element */ 131 | moe = index(boe,'+'); 132 | if ( moe != NULL ) { 133 | d=*moe; 134 | *moe='\0'; 135 | } 136 | 137 | /* get cores nb for each of those nodes */ 138 | noe = strstr(boe,"ppn="); 139 | if ( noe != NULL ) { 140 | noe+=4; 141 | eoe=noe; 142 | while ( isdigit(*eoe) ) 143 | eoe++; 144 | c=*eoe; 145 | *eoe='\0'; 146 | sscanf(noe,"%d",&core); 147 | *eoe=c; 148 | } 149 | total += node * core ; 150 | 151 | if ( moe != NULL ) 152 | *moe=d; 153 | 154 | /* search next element */ 155 | boe = index(boe,'+'); 156 | if ( boe != NULL ) 157 | boe++; 158 | 159 | } 160 | 161 | *i=total; 162 | 163 | return 0; 164 | } 165 | 166 | int extract_uint32(char* statusline,char* header,uint32_t* i) 167 | { 168 | char* field; 169 | 170 | if ( extract_field(statusline,header,&field) == 0 ) { 171 | sscanf(field,"%u",i); 172 | free(field); 173 | return 0; 174 | } 175 | 176 | return 1; 177 | } 178 | 179 | int convert_mem(char* field,uint32_t* i) 180 | { 181 | char unit[3]; 182 | uint32_t mem; 183 | 184 | 185 | if ( sscanf(field,"%u%2s",&mem,unit) == 2 ) { 186 | unit[2]='\0'; 187 | if ( strcmp(unit,"kb") == 0 ) 188 | mem = mem / 1024 ; 189 | else if ( strcmp(unit,"gb") == 0 ) 190 | mem = mem * 1024 ; 191 | else 192 | return 1; 193 | *i = mem; 194 | return 0; 195 | } 196 | 197 | return 1; 198 | } 199 | 200 | int convert_time(char* field,time_t* t) 201 | { 202 | time_t hour,min,sec; 203 | 204 | 205 | 206 | if ( sscanf(field,"%lu:%lu:%lu",&hour,&min,&sec) == 3 ) { 207 | *t = hour*3600 + min*60 + sec ; 208 | return 0; 209 | } 210 | 211 | return 1; 212 | } 213 | -------------------------------------------------------------------------------- /plugins/batch/slurm/batch_common.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * plugins/batch/slurm/batch_common.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | 24 | #ifndef __BATCH_COMMON_H 25 | #define __BATCH_COMMON_H 26 | 27 | int extract_field(char* statusline,char* header,char** field); 28 | 29 | int extract_mem(char* statusline,char* header,uint32_t* i); 30 | 31 | int extract_float(char* statusline,char* header,float* load); 32 | 33 | int extract_uint32(char* statusline,char* header,uint32_t* i); 34 | 35 | int extract_cores(char* line,uint32_t* i); 36 | 37 | int convert_mem(char* field,uint32_t* mem); 38 | 39 | int convert_time(char* field,time_t* time); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /plugins/batch/torque/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | # TORQUE_*FLAGS are got from m4 macro 4 | 5 | if HAVE_TORQUE 6 | 7 | PLUGIN_FLAGS = 8 | 9 | AM_CPPFLAGS = $(TORQUE_CPPFLAGS) -I$(top_srcdir)/lib -g 10 | 11 | lib_LTLIBRARIES = libbridge_bs_torque.la 12 | libbridge_bs_torque_la_SOURCES = batch_manager.c batch_node.c batch_queue.c \ 13 | batch_session.c batch_common.c batch_common.h 14 | libbridge_bs_torque_la_LDFLAGS = -module -avoid-version \ 15 | --export-dynamic $(TORQUE_LDFLAGS) 16 | 17 | endif # HAVE_TORQUE 18 | -------------------------------------------------------------------------------- /plugins/batch/torque/batch_common.c: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * plugins/batch/torque/batch_common.c - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #include "config.h" 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #include 34 | 35 | #include "batch_common.h" 36 | 37 | #define DEBUG_LOGGER xdebug 38 | #define DEBUG2_LOGGER xdebug2 39 | #define DEBUG3_LOGGER xdebug3 40 | #define ERROR_LOGGER xerror 41 | 42 | int extract_field(char* statusline,char* header,char** field) 43 | { 44 | char* p; 45 | char* e; 46 | 47 | size_t s; 48 | 49 | p = strstr(statusline,header); 50 | 51 | if ( p != NULL ) { 52 | p+= strlen(header); 53 | e = strchr(p,','); 54 | if ( e == NULL ) 55 | *field = strdup(p); 56 | else { 57 | s = (size_t) (e-p); 58 | *field = (char*) malloc ( (s+1) * sizeof(char) ); 59 | memcpy(*field,p,s); 60 | (*field)[s]='\0'; 61 | } 62 | return 0; 63 | } 64 | 65 | return 1; 66 | } 67 | 68 | int extract_mem(char* statusline,char* header,uint32_t* i) 69 | { 70 | int fstatus; 71 | char* field; 72 | 73 | if ( extract_field(statusline,header,&field) == 0 ) { 74 | fstatus = convert_mem(field,i); 75 | free(field); 76 | return fstatus; 77 | } 78 | 79 | return 1; 80 | } 81 | 82 | int extract_float(char* statusline,char* header,float* load) 83 | { 84 | char* p; 85 | char* e; 86 | char* field; 87 | 88 | if ( extract_field(statusline,header,&field) == 0 ) { 89 | sscanf(field,"%f",load); 90 | free(field); 91 | return 0; 92 | } 93 | 94 | return 1; 95 | 96 | } 97 | 98 | int extract_cores(char* line,uint32_t* i) 99 | { 100 | 101 | char* boe; 102 | char* noe; 103 | char* moe; 104 | char* eoe; 105 | char c,d; 106 | 107 | uint32_t core; 108 | uint32_t node; 109 | uint32_t total; 110 | 111 | total=0; 112 | 113 | boe=line; 114 | 115 | /* a line is elt[,elt]* */ 116 | /* elt is node_nb[:...]* ppn=core_nb */ 117 | while ( boe != NULL ) { 118 | 119 | node=0; 120 | core=1; 121 | 122 | /* get nodes nb */ 123 | eoe=boe; 124 | while ( isdigit(*eoe) ) 125 | eoe++; 126 | c=*eoe; 127 | *eoe='\0'; 128 | sscanf(boe,"%d",&node); 129 | *eoe=c; 130 | 131 | /* search the end of the element */ 132 | moe = index(boe,'+'); 133 | if ( moe != NULL ) { 134 | d=*moe; 135 | *moe='\0'; 136 | } 137 | 138 | /* get cores nb for each of those nodes */ 139 | noe = strstr(boe,"ppn="); 140 | if ( noe != NULL ) { 141 | noe+=4; 142 | eoe=noe; 143 | while ( isdigit(*eoe) ) 144 | eoe++; 145 | c=*eoe; 146 | *eoe='\0'; 147 | sscanf(noe,"%d",&core); 148 | *eoe=c; 149 | } 150 | total += node * core ; 151 | 152 | if ( moe != NULL ) 153 | *moe=d; 154 | 155 | /* search next element */ 156 | boe = index(boe,'+'); 157 | if ( boe != NULL ) 158 | boe++; 159 | 160 | } 161 | 162 | *i=total; 163 | 164 | return 0; 165 | } 166 | 167 | int extract_uint32(char* statusline,char* header,uint32_t* i) 168 | { 169 | char* field; 170 | 171 | if ( extract_field(statusline,header,&field) == 0 ) { 172 | sscanf(field,"%u",i); 173 | free(field); 174 | return 0; 175 | } 176 | 177 | return 1; 178 | } 179 | 180 | int convert_mem(char* field,uint32_t* i) 181 | { 182 | char unit[3]; 183 | uint32_t mem; 184 | 185 | 186 | if ( sscanf(field,"%u%2s",&mem,unit) == 2 ) { 187 | unit[2]='\0'; 188 | if ( strcmp(unit,"kb") == 0 ) 189 | mem = mem / 1024 ; 190 | else if ( strcmp(unit,"gb") == 0 ) 191 | mem = mem * 1024 ; 192 | else 193 | return 1; 194 | *i = mem; 195 | return 0; 196 | } 197 | 198 | return 1; 199 | } 200 | 201 | int convert_time(char* field,time_t* t) 202 | { 203 | char unit[3]; 204 | time_t time,hour,min,sec; 205 | 206 | 207 | 208 | if ( sscanf(field,"%u:%u:%u",&hour,&min,&sec) == 3 ) { 209 | *t = hour*3600 + min*60 + sec ; 210 | return 0; 211 | } 212 | 213 | return 1; 214 | } 215 | -------------------------------------------------------------------------------- /plugins/batch/torque/batch_common.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * plugins/batch/torque/batch_common.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | 24 | #ifndef __BATCH_COMMON_H 25 | #define __BATCH_COMMON_H 26 | 27 | int extract_field(char* statusline,char* header,char** field); 28 | 29 | int extract_mem(char* statusline,char* header,uint32_t* i); 30 | 31 | int extract_float(char* statusline,char* header,float* load); 32 | 33 | int extract_uint32(char* statusline,char* header,uint32_t* i); 34 | 35 | int extract_cores(char* line,uint32_t* i); 36 | 37 | int convert_mem(char* field,uint32_t* mem); 38 | 39 | int convert_time(char* field,time_t* time); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /plugins/rm/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = slurm 2 | -------------------------------------------------------------------------------- /plugins/rm/slurm/Makefile.am: -------------------------------------------------------------------------------- 1 | # SLURM_*FLAGS are got from m4 macro during configure 2 | 3 | if HAVE_SLURM 4 | 5 | AM_CPPFLAGS = $(SLURM_CPPFLAGS) -I$(top_srcdir)/lib 6 | 7 | lib_LTLIBRARIES = libbridge_rm_slurm.la 8 | libbridge_rm_slurm_la_SOURCES = slurm_rm_manager.c 9 | libbridge_rm_slurm_la_LDFLAGS = -module -avoid-version --export-dynamic $(SLURM_LDFLAGS) 10 | 11 | endif # HAVE_SLURM 12 | -------------------------------------------------------------------------------- /scripts/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = common batch_system resource_manager addons 2 | -------------------------------------------------------------------------------- /scripts/addons/Makefile.am: -------------------------------------------------------------------------------- 1 | scriptsdir = $(datadir)/scripts 2 | addonscriptsdir = $(scriptsdir)/addons 3 | 4 | dist_addonscripts_DATA = autoaccount.ad \ 5 | autocarto.ad \ 6 | autodefmem.ad \ 7 | autoexclusive.ad \ 8 | automem-slurm.ad \ 9 | automem-slurm-resize.ad \ 10 | autompi.ad \ 11 | autopacking.ad \ 12 | autoqueue.ad \ 13 | autoswitches-slurm.ad \ 14 | bcast.ad \ 15 | bridge-profile.ad \ 16 | bullmpi-slurm.ad \ 17 | bullmpi-slurm-direct.ad \ 18 | bullmpi-slurm-pin.ad \ 19 | bullxmpi-slurm.ad \ 20 | bullxmpi-slurm-direct.ad \ 21 | bullxmpi-slurm-pin.ad \ 22 | compat-DAM.ad \ 23 | ddt.ad \ 24 | dirige.ad \ 25 | example.ad \ 26 | intelmpi-slurm.ad \ 27 | inter-para-limits.ad \ 28 | logger.ad \ 29 | mpmd-cluster.ad \ 30 | mpmd-cluster-wrapper.ad \ 31 | mpmd-ws.ad \ 32 | mvapich2-slurm.ad \ 33 | mvapich-slurm.ad \ 34 | openmpi-slurm.ad \ 35 | openmpi-slurm-direct.ad \ 36 | preload.ad \ 37 | qos.ad \ 38 | relax_affinity.ad \ 39 | reservation.ad \ 40 | filesystems.ad \ 41 | spank-stats.ad \ 42 | strace.ad \ 43 | shell.ad \ 44 | tagoutput.ad \ 45 | totalview.ad \ 46 | vtune.ad \ 47 | wrapper-DAM.ad \ 48 | x11.ad \ 49 | bulk-flux.ad \ 50 | flux.ad \ 51 | stdio-flux.ad \ 52 | mpmd-cluster-heterogenous.ad \ 53 | env-cleaner.ad 54 | 55 | dist_addonscripts_SCRIPTS = vtune.sh spank-stats.sh strace.sh 56 | -------------------------------------------------------------------------------- /scripts/addons/autodefmem.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/autodefmem.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | # This addon is meant as a workaround to the slurm limitation that only a single DefMemPerCPU and MaxMemPerCPU can be set across the whole cluster. It simulates a value of DefMemPerCPU equal to the amount of memory available per CPU in the requested partition. 24 | 25 | # Note: for this to work in all cases, BRIDGE_*_DEFAULT_MAXMEM and BRIDGE_*_DEFAULT_QUEUE/PARTIION must be set to sensible values. 26 | 27 | 28 | ##MSUB 29 | function bridge_addon_msub_setopt { 30 | return 0 31 | } 32 | 33 | function bridge_addon_msub_getopt { 34 | return 0 35 | } 36 | 37 | function bridge_addon_msub_alteropt { 38 | 39 | ## on se place en mode debug si souhaite 40 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 41 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 42 | then 43 | set -x 44 | fi 45 | 46 | ## on incremente le niveau de log 47 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 48 | 49 | ## on ajoute une entete a la log 50 | typeset LOGGER="${LOGGER} Bridge AutoDefMem Addon :" 51 | 52 | ## do auto-selection only if max_mem is not already set and the user specifies a partition 53 | if [[ -z ${BRIDGE_MSUB_MAXMEM} && -n ${BRIDGE_MSUB_QUEUE} ]] 54 | then 55 | BRIDGE_MSUB_MAXMEM=`sinfo -p ${BRIDGE_MSUB_QUEUE} -heo %c,%m | awk -F ',' '{v=$2/$1; if(min == 0 || min>v) min=int(v) } END {print min}'` 56 | 57 | ### display auto-mem result 58 | if [[ -n ${BRIDGE_MSUB_MAXMEM} ]] 59 | then 60 | ${LOGGER} "max mem is now '${BRIDGE_MSUB_MAXMEM}'" 61 | else 62 | ${LOGGER} "unable to auto select max mem" 63 | fi 64 | else 65 | ${LOGGER} "max mem is already set, skipping" 66 | fi 67 | 68 | return 0 69 | } 70 | 71 | function bridge_addon_msub_alterscript { 72 | return 0 73 | } 74 | 75 | ##MPRUN 76 | function bridge_addon_mprun_setopt { 77 | return 0 78 | } 79 | 80 | function bridge_addon_mprun_getopt { 81 | return 0 82 | } 83 | 84 | function bridge_addon_mprun_alteropt { 85 | ## on se place en mode debug si souhaite 86 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 87 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 88 | then 89 | set -x 90 | fi 91 | 92 | ## on incremente le niveau de log 93 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 94 | 95 | ## on ajoute une entete a la log 96 | typeset LOGGER="${LOGGER} Bridge AutoDefMem Addon :" 97 | 98 | if [[ "${BRIDGE_MPRUN_ALLOCATION}" == yes ]] then 99 | ${LOGGER} "wrapping allocation detected: skipping" 100 | return 0 101 | fi 102 | 103 | ## do auto-selection only if max_mem is not already set and the user specifies a partition 104 | if [[ -z ${bridge_mprun_maxmem} && -n ${bridge_mprun_partition} ]] 105 | then 106 | 107 | bridge_mprun_maxmem=`sinfo -p ${bridge_mprun_partition} -heo %c,%m | awk -F ',' '{v=$2/$1; if(min == 0 || min>v) min=int(v) } END {print min}'` 108 | 109 | if [[ -n ${bridge_mprun_maxmem} ]] 110 | then 111 | ${LOGGER} "max mem is now '${bridge_mprun_maxmem}'" 112 | else 113 | ${LOGGER} "unable to auto select max mem" 114 | fi 115 | else 116 | ${LOGGER} "default partition requested or max mem already set, skipping" 117 | fi 118 | 119 | return 0 120 | } 121 | 122 | function bridge_addon_mprun_spmd_pre_allocate { 123 | return 0 124 | } 125 | 126 | 127 | function bridge_addon_mprun_spmd_post_allocate { 128 | return 0 129 | } 130 | 131 | 132 | function bridge_addon_mprun_spmd_pre_run { 133 | return 0 134 | } 135 | 136 | function bridge_addon_mprun_spmd_post_run { 137 | return 0 138 | } 139 | -------------------------------------------------------------------------------- /scripts/addons/autompi.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/autompi.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | ################################################################################# 24 | # 25 | # Addon for MPI type auto-detection in Bridge 26 | # 27 | # set bridge_mprun_mpi_type to one of the following value according to 28 | # the mpicc flavour found in the PATH 29 | # 30 | # - openmpi : OpenMPI 31 | # - mpich : MPICH V1 32 | # - mpich2 : MPICH v2 33 | # - hpmpi : HP MPI 34 | # - none : no mpicc found in the path 35 | # 36 | ################################################################################# 37 | 38 | function bridge_addon_mprun_setopt { 39 | 40 | return 0 41 | 42 | } 43 | 44 | function bridge_addon_mprun_getopt { 45 | 46 | return 0 47 | 48 | } 49 | 50 | function bridge_addon_mprun_alteropt { 51 | 52 | ## on se place en mode debug si souhaite 53 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 54 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 55 | then 56 | set -x 57 | fi 58 | 59 | ## on incremente le niveau de log 60 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 61 | 62 | ## on ajoute une entete a la log 63 | typeset LOGGER="${LOGGER} MPI Type autodetect Addon :" 64 | 65 | mpipath=$(which mpirun 2>/dev/null) 66 | if [ $? -ne 0 ] 67 | then 68 | bridge_mprun_mpi_type=none 69 | return 0 70 | fi 71 | 72 | case ${mpipath} in 73 | 74 | *openmpi* ) 75 | bridge_mprun_mpi_type=openmpi 76 | spmd_run_separator=" " 77 | ;; 78 | 79 | *mpich-1* ) 80 | bridge_mprun_mpi_type=mpich 81 | ;; 82 | 83 | *mpich2*) 84 | bridge_mprun_mpi_type=mpich2 85 | ;; 86 | 87 | */hp/* ) 88 | bridge_mprun_mpi_type=hpmpi 89 | ;; 90 | 91 | /usr/bin/mpirun ) 92 | # consider /usr/bin/mpirun as the default MPI 93 | # distribution of the system which on RHEL6 is 94 | # mpich2 (which does not support "--" as a 95 | # separator between params and app command line 96 | bridge_mprun_mpi_type=mpich2 97 | spmd_run_separator=" " 98 | ;; 99 | 100 | *) 101 | # let a potential default value 102 | ;; 103 | 104 | esac 105 | 106 | ${LOGGER} "MPI type is \"${bridge_mprun_mpi_type}\"" 107 | 108 | return 0 109 | 110 | } 111 | 112 | function bridge_addon_mprun_spmd_pre_allocate { 113 | 114 | return 0 115 | 116 | } 117 | 118 | function bridge_addon_mprun_spmd_post_allocate { 119 | 120 | return 0 121 | 122 | } 123 | 124 | function bridge_addon_mprun_spmd_pre_run { 125 | 126 | case "${bridge_mprun_mpi_type}" in 127 | mpich) 128 | spmd_run_options+=( "-all-local" ) 129 | ;; 130 | openmpi) 131 | spmd_run_options+=( "--launch-agent" "LD_LIBRARY_PATH=$LD_LIBRARY_PATH orted" ) 132 | ;; 133 | *) 134 | ;; 135 | esac 136 | 137 | return 0 138 | 139 | } 140 | 141 | function bridge_addon_mprun_spmd_post_run { 142 | 143 | return 0 144 | 145 | } 146 | -------------------------------------------------------------------------------- /scripts/addons/autoqueue.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/autoqueue.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | 24 | function bridge_addon_msub_setopt { 25 | return 0 26 | } 27 | 28 | function bridge_addon_msub_getopt { 29 | return 0 30 | } 31 | 32 | 33 | function bridge_addon_msub_alteropt { 34 | 35 | ## on se place en mode debug si souhaite 36 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 37 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 38 | then 39 | set -x 40 | fi 41 | 42 | ## on incremente le niveau de log 43 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 44 | 45 | ## on ajoute une entete a la log 46 | typeset LOGGER="${LOGGER} DAM Auto-queue Addon :" 47 | 48 | ## do auto-selection only if queue is not already set 49 | if [[ -z ${BRIDGE_MSUB_QUEUE} ]] 50 | then 51 | typeset partname= 52 | typeset parttlim= 53 | typeset partncpus= 54 | typeset bestpartname= 55 | typeset bestparttlim= 56 | typeset bestpartncpus= 57 | typeset jobtime=${BRIDGE_MSUB_MAXTIME:-0} 58 | typeset nb_cpus=${BRIDGE_MSUB_NPROC:-1} 59 | typeset nb_cores=${BRIDGE_MSUB_NCORE:-1} 60 | (( nb_cpus = nb_cpus * nb_cores )) 61 | 62 | ${LOGGER} "required time is ${jobtime}s - required cpus nb is ${nb_cpus}" 63 | 64 | if [[ -z ${BRIDGE_MSUB_ALLOWED_QUEUE} ]] 65 | then 66 | BRIDGE_MSUB_ALLOWED_QUEUE="batch|nor_seq|nor_par|lit_par|express|big_par" 67 | fi 68 | BRIDGE_MSUB_QUEUE=$(${BRIDGE_BQSTAT_CMD} -o name,maxpartime,maxparcpunb | \ 69 | egrep "${BRIDGE_MSUB_ALLOWED_QUEUE}" | grep -v "?" |\ 70 | sed s/\-/10000000/ | sort -n -k 3 -k 2 | \ 71 | awk -vtlim=${jobtime} -vcpu=${nb_cpus} \ 72 | 'BEGIN{s=0;}{ if ( tlim <= $2 && cpu <= $3 ) { s=1; print $1 ;}}END{if ( s == 0 ) print $1;}' | head -n 1 ) 73 | 74 | ### display auto-queue result 75 | if [[ -n ${BRIDGE_MSUB_QUEUE} ]] 76 | then 77 | ${LOGGER} "job queue is now '${BRIDGE_MSUB_QUEUE}'" 78 | else 79 | ${LOGGER} "unable to auto select a queue" 80 | fi 81 | else 82 | ${LOGGER} "queue '${BRIDGE_MSUB_QUEUE}' is already set, skipping" 83 | fi 84 | 85 | return 0 86 | 87 | } 88 | 89 | 90 | function bridge_addon_msub_alterscript { 91 | return 0 92 | } 93 | -------------------------------------------------------------------------------- /scripts/addons/compat-DAM.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/compat-DAM.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | function bridge_addon_msub_setopt { 24 | 25 | return 0 26 | 27 | } 28 | 29 | function bridge_addon_msub_getopt { 30 | 31 | return ${exit_status} 32 | } 33 | 34 | 35 | function bridge_addon_msub_alteropt { 36 | 37 | ## on se place en mode debug si souhaite 38 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 39 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 40 | then 41 | set -x 42 | fi 43 | 44 | ## on incremente le niveau de log 45 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 46 | 47 | ## on ajoute une entete a la log 48 | typeset LOGGER="${LOGGER} DAM compat Addon :" 49 | 50 | ## compatibilite DAM ('-N' si pas de '-n', equivaut a '-n') 51 | if [[ -n ${BRIDGE_MSUB_NNODE} ]] && [[ -z ${BRIDGE_MSUB_NPROC} ]] 52 | then 53 | BRIDGE_MSUB_NPROC=${BRIDGE_MSUB_NNODE} 54 | BRIDGE_MSUB_NNODE= 55 | ${LOGGER} "swapping -N ${BRIDGE_MSUB_NPROC} with -n ${BRIDGE_MSUB_NPROC}" 56 | fi 57 | 58 | return 0 59 | 60 | } 61 | 62 | 63 | function bridge_addon_msub_alterscript { 64 | 65 | return 0 66 | 67 | } 68 | -------------------------------------------------------------------------------- /scripts/addons/dirige.ad: -------------------------------------------------------------------------------- 1 | #!/bin/ksh 2 | #*****************************************************************************\ 3 | # scripts/addons/dirige.ad - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | 25 | function bridge_addon_msub_setopt { 26 | return 0 27 | } 28 | 29 | function bridge_addon_msub_getopt { 30 | return 0 31 | } 32 | 33 | 34 | function bridge_addon_msub_alteropt { 35 | 36 | ## on se place en mode debug si souhaite 37 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 38 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 39 | then 40 | set -x 41 | fi 42 | 43 | ## on incremente le niveau de log 44 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 45 | 46 | ## on ajoute une entete a la log 47 | typeset LOGGER="${LOGGER} dirige Wrapper Addon :" 48 | typeset ERROR="${ERROR} dirige Wrapper Addon :" 49 | : 50 | ## le script a modifier doit etre accessible en tant que 1er argument 51 | if [[ -z ${BRIDGE_MSUB_SCRIPTFILE} ]] 52 | then 53 | ${LOGGER} "no script defined in variable 'BRIDGE_MSUB_SCRIPTFILE', skipping" 54 | return 1 55 | fi 56 | 57 | BRIDGE_DIRIGE_CMD="${BRIDGE_DIRIGE_CMD:=$(which dirige 2>/dev/null)}" 58 | if [ ! -f "$BRIDGE_DIRIGE_CMD" ] ;then 59 | return 1 60 | fi 61 | 62 | ## on recherche l'utilisation de la commande dirige dans le jobscript 63 | egrep -q "(^\ *dirige($|\ ))|(^\ *${BRIDGE_DIRIGE_CMD}($|\ ))" ${BRIDGE_MSUB_SCRIPTFILE} 64 | if [[ $? -eq 0 ]] 65 | then 66 | if [ -z "$CCCSPOOLDIR" ] ; then 67 | export CCCSPOOLDIR="$CCCSCRATCHDIR/.SPOOL" 68 | fi 69 | if [ ! -d "$CCCSPOOLDIR" ] ; then 70 | mkdir $CCCSPOOLDIR 2>/dev/null 71 | fi 72 | 73 | # on cree/initialise les repertoires de travail necessaires dans $CCCSPOOLDI a l'aide de la commande dirige 74 | ${BRIDGE_DIRIGE_CMD} -I 75 | 76 | if [[ -z ${BRIDGE_DIRIGE_SPOOLDIR} ]] 77 | then 78 | BRIDGE_DIRIGE_SPOOLDIR="${CCCSPOOLDIR}/listings/files" 79 | fi 80 | if [[ ! -d ${BRIDGE_DIRIGE_SPOOLDIR} ]] 81 | then 82 | ${ERROR} "dirige requested but user spool directory '${BRIDGE_DIRIGE_SPOOLDIR}' does not exist. fatal" 83 | exit 1 84 | else 85 | export BRIDGE_MSUB_STDOUT="${BRIDGE_DIRIGE_SPOOLDIR}/${BRIDGE_MSUB_REQNAME}.%j.o" 86 | export BRIDGE_MSUB_STDERR="${BRIDGE_DIRIGE_SPOOLDIR}/${BRIDGE_MSUB_REQNAME}.%j.e" 87 | ${LOGGER} "dirige mode activated" 88 | fi 89 | fi 90 | 91 | return 0 92 | } 93 | 94 | function bridge_addon_msub_alterscript { 95 | return 0 96 | } 97 | 98 | -------------------------------------------------------------------------------- /scripts/addons/inter-para-limits.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/inter-para-limits.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | 24 | ################################################################################# 25 | # 26 | # Addon to broadcast executable in Bridge with Slurm prior parallel launch 27 | # 28 | # 29 | ################################################################################# 30 | 31 | function bridge_addon_mprun_setopt { 32 | 33 | return 0 34 | 35 | } 36 | 37 | function bridge_addon_mprun_getopt { 38 | 39 | return 0 40 | 41 | } 42 | 43 | function bridge_addon_mprun_alteropt { 44 | 45 | ## on se place en mode debug si souhaite 46 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 47 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 48 | then 49 | set -x 50 | fi 51 | 52 | ## on incremente le niveau de log 53 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 54 | 55 | ## on ajoute une entete a la log 56 | typeset LOGGER="${LOGGER} Inter-para-limits Addon :" 57 | 58 | if [ "$BRIDGE_MSUB_MAXTIME" != "" ] ;then 59 | return 0 60 | fi 61 | 62 | 63 | LIMIT_FILE=$BRIDGE_MPRUN_MAXTIME_CONF_FILE 64 | if [ ! -f $LIMIT_FILE ] ; then 65 | return 0 66 | fi 67 | 68 | # on fixe une valeur de depart nulle et on parse le fichier de conf 69 | # a la recherche de la valeur correspondant au nombre demande 70 | TIMELIMIT=0 71 | while read LINE 72 | do 73 | echo $LINE | grep "#" >/dev/null 74 | if [ $? = 0 ] ; then continue ; fi 75 | set -- $LINE 76 | PE=$1 ; TLIM=$2 77 | if [ "$bridge_mprun_nproc" -le $PE -o $PE = "-1" ] 78 | then 79 | TIMELIMIT=$TLIM 80 | break 81 | fi 82 | done < $LIMIT_FILE 83 | 84 | if [ "$bridge_mprun_maxtime" = "" -o "$bridge_mprun_maxtime" -gt $TIMELIMIT ] ; then 85 | ${LOGGER} "set time limit to $TIMELIMIT sec" 86 | bridge_mprun_maxtime=$TIMELIMIT 87 | fi 88 | 89 | return 0 90 | } 91 | 92 | function bridge_addon_mprun_spmd_pre_run { 93 | 94 | return 0 95 | 96 | } 97 | 98 | function bridge_addon_mprun_spmd_pre_allocate { 99 | 100 | return 0 101 | 102 | } 103 | 104 | function bridge_addon_mprun_spmd_post_allocate { 105 | 106 | return 0 107 | 108 | } 109 | 110 | function bridge_addon_mprun_spmd_post_run { 111 | 112 | return 0 113 | 114 | } 115 | -------------------------------------------------------------------------------- /scripts/addons/logger.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/logger.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | # 24 | # Addon that help to log the user command executed by mprun. It only prints 25 | # the trailing components once the basic mprun options have been processed. 26 | # 27 | # Parameters can be set using the following environment variable: 28 | # 29 | # BRIDGE_ADDON_LOGGER_CMD : command to use to log the messages. 30 | # default to "logger" 31 | # BRIDGE_ADDON_LOGGER_PRIORITY: pass this value to the command using a -p option. 32 | # useful to select the facility with logger. 33 | # default is no particular priority. 34 | # BRIDGE_ADDON_LOGGER_TAG: pass this value to the command using a -t option. 35 | # useful to select the tag with logger. 36 | # default is "BRIDGE". 37 | # BRIDGE_ADDON_LOGGER_EXTRA_INFOS: add the content of the variables to the logger line 38 | # default is the empty string. 39 | # 40 | 41 | ### MSUB ### MSUB ### MSUB ### MSUB ### MSUB ### MSUB ### MSUB ### MSUB ### MSUB ### MSUB 42 | 43 | function bridge_addon_msub_setopt { 44 | return 0 45 | } 46 | 47 | function bridge_addon_msub_getopt { 48 | return 0 49 | } 50 | 51 | function bridge_addon_msub_alteropt { 52 | return 0 53 | } 54 | 55 | function bridge_addon_msub_alterscript { 56 | return 0 57 | } 58 | 59 | ### MPRUN ### MPRUN ### MPRUN ### MPRUN ### MPRUN ### MPRUN ### MPRUN ### MPRUN ### MPRUN 60 | 61 | function bridge_addon_mprun_setopt { 62 | return 0 63 | } 64 | 65 | function bridge_addon_mprun_getopt { 66 | return 0 67 | } 68 | 69 | function bridge_addon_mprun_alteropt { 70 | 71 | ## on se place en mode debug si souhaite 72 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 73 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 74 | then 75 | set -x 76 | fi 77 | 78 | ## on incremente le niveau de log 79 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 80 | 81 | ## on ajoute une entete a la log 82 | typeset LOGGER="${LOGGER} Logger Addon :" 83 | 84 | ## on fixe la ligne de commande permettant de logger 85 | typeset xlogger_cmd=${BRIDGE_ADDON_LOGGER_CMD:-logger} 86 | typeset xlogger_args= 87 | if [[ -n ${BRIDGE_ADDON_LOGGER_PRIORITY} ]] 88 | then 89 | xlogger_args="${xlogger_args} -p ${BRIDGE_ADDON_LOGGER_PRIORITY}" 90 | fi 91 | if [[ -n ${BRIDGE_ADDON_LOGGER_TAG:-BRIGDE} ]] 92 | then 93 | xlogger_args="${xlogger_args} -t ${BRIDGE_ADDON_LOGGER_TAG:-BRIDGE}" 94 | fi 95 | ${LOGGER} "logging using cmdline '${xlogger_cmd} ${xlogger_args}'" 96 | 97 | ## on collecte des infos 98 | xuid=$(id -u) 99 | xuser=$(id -un) 100 | xbatchid=${BRIDGE_MSUB_JOBID:--} 101 | 102 | ## on print la ligne de log 103 | if [[ ${BRIDGE_LOGGER_MPRUN_ALTEROPT} != 1 ]] 104 | then 105 | ${xlogger_cmd} ${xlogger_args} "user=${xuser} batchid=${xbatchid} extra=${BRIDGE_ADDON_LOGGER_EXTRA_INFOS:--}" \ 106 | "$(basename ${bridge_mprun_cmd})_args=${bridge_mprun_args}" 107 | fi 108 | export BRIDGE_LOGGER_MPRUN_ALTEROPT=1 109 | 110 | return 0 111 | 112 | } 113 | 114 | function bridge_addon_mprun_spmd_pre_allocate { 115 | return 0 116 | } 117 | 118 | 119 | function bridge_addon_mprun_spmd_post_allocate { 120 | return 0 121 | } 122 | 123 | 124 | function bridge_addon_mprun_spmd_pre_run { 125 | return 0 126 | } 127 | 128 | function bridge_addon_mprun_spmd_post_run { 129 | return 0 130 | } 131 | -------------------------------------------------------------------------------- /scripts/addons/mpmd-cluster-wrapper.ad: -------------------------------------------------------------------------------- 1 | #!/bin/ksh 2 | # 3 | #/********************************************************************************************************************\ 4 | # 5 | # Cet addon msub permet de se placer en mode MPMD en environnement cluster a l'aide du wrapper bridge mpmd_wrapper 6 | # 7 | #\********************************************************************************************************************/ 8 | 9 | function bridge_addon_mprun_setopt { 10 | 11 | typeset MYGETOPTOPTION="F:" 12 | 13 | echo "${BRIDGE_MPRUN_GETOPT_OPTIONS}" | grep -q ${MYGETOPTOPTION} 14 | 15 | if [ $? -ne 0 ] 16 | then 17 | BRIDGE_MPRUN_GETOPT_OPTIONS="${BRIDGE_MPRUN_GETOPT_OPTIONS}${MYGETOPTOPTION}" 18 | fi 19 | 20 | return 0 21 | 22 | } 23 | 24 | function bridge_addon_mprun_getopt { 25 | 26 | ## on se place en mode debug si souhaite 27 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 28 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 29 | then 30 | set -x 31 | fi 32 | 33 | ## on incremente le niveau de log 34 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 35 | 36 | ## on ajoute une entete a la log 37 | typeset LOGGER="${LOGGER} MPMD Addon :" 38 | 39 | ## par defaut, on desactive le mode MPMD 40 | if [[ -z ${BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT} ]] 41 | then 42 | BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT= 43 | fi 44 | 45 | ## on fixe le message d'aide a afficher si demande 46 | typeset USAGE="\ 47 | \t*) MPMD (Multiple Programs Multiple Data) (debugging aware flavor) 48 | \t\t -F descfile : activate MPMD mode using tasks description file 'descfile'\n" 49 | 50 | ## on fixe le status de sortie par defaut 51 | typeset exit_status=0 52 | 53 | ## on parse les arguments 54 | while getopts ${BRIDGE_MPRUN_GETOPT_OPTIONS} option 55 | do 56 | case ${option} in 57 | 58 | h) 59 | echo -e "${USAGE}" >&2 60 | return 0 61 | ;; 62 | 63 | F) 64 | BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT=${OPTARG} 65 | BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_STAGE=1 66 | ;; 67 | 68 | *) 69 | ;; 70 | esac 71 | done 72 | export BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT 73 | export BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_STAGE 74 | 75 | return ${exit_status} 76 | } 77 | 78 | 79 | function bridge_addon_mprun_alteropt { 80 | 81 | ## on se place en mode debug si souhaite 82 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 83 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 84 | then 85 | set -x 86 | fi 87 | 88 | ## on incremente le niveau de log 89 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 90 | 91 | ## on ajoute une entete a la log 92 | typeset LOGGER="${LOGGER} MPMD Addon :" 93 | 94 | if [[ ${BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_STAGE} -eq 1 ]] 95 | then 96 | 97 | if [[ ! -r ${BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT} ]] 98 | then 99 | ${ERROR} "MPMD Addon : invalid task file ${BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT}" 100 | else 101 | ${LOGGER} "using tasks file ${BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT}" 102 | 103 | ### on recupere le nombre de taches a executer 104 | typeset NBTASK_CUMUL=0 105 | typeset NBTASK 106 | typeset CMD 107 | cat ${BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT} | egrep -v "^#" | while read NBTASK CMD 108 | do 109 | (( NBTASK_CUMUL = NBTASK_CUMUL + NBTASK )) 110 | done 111 | 112 | ### on met a jour le nombre de tache 113 | bridge_mprun_nproc=${NBTASK_CUMUL} 114 | ${LOGGER} "task count is now ${bridge_mprun_nproc}" 115 | 116 | ### on demande a executer le wrapper mpmd fournit par bridge 117 | bridge_mprun_args=( "${BRIDGE_BINDIR}/$(bridge_command_enhance mpmd_wrapper)" "-f" "${BRIDGE_MPRUN_ADDON_MPMD_WRAPPER_SCRIPT}" ) 118 | ${LOGGER} "now executing ${bridge_mprun_args}" 119 | fi 120 | 121 | fi 122 | 123 | return 0 124 | } 125 | 126 | function bridge_addon_mprun_spmd_pre_allocate { 127 | return 0 128 | } 129 | 130 | function bridge_addon_mprun_spmd_post_allocate { 131 | return 0 132 | } 133 | 134 | function bridge_addon_mprun_spmd_pre_run { 135 | return 0 136 | } 137 | 138 | function bridge_addon_mprun_spmd_post_run { 139 | return 0 140 | } 141 | 142 | function bridge_addon_msub_alterscript { 143 | return 0 144 | } 145 | -------------------------------------------------------------------------------- /scripts/addons/mvapich-slurm.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/mvapich-slurm.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | ################################################################################# 24 | # 25 | # Addon for MVAPICH support in Bridge with Slurm 26 | # 27 | # 28 | ################################################################################# 29 | 30 | function bridge_addon_mprun_setopt { 31 | 32 | return 0 33 | 34 | } 35 | 36 | function bridge_addon_mprun_getopt { 37 | 38 | ## on se place en mode debug si souhaite 39 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 40 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 41 | then 42 | set -x 43 | fi 44 | 45 | ## on incremente le niveau de log 46 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 47 | 48 | ## on ajoute une entete a la log 49 | typeset LOGGER="${LOGGER} MVAPICH Addon :" 50 | 51 | ## on fixe le status de sortie par defaut 52 | typeset exit_status=0 53 | 54 | ## on parse les arguments 55 | while getopts ${BRIDGE_MPRUN_GETOPT_OPTIONS} option 56 | do 57 | case ${option} in 58 | 59 | h) 60 | return 0 61 | ;; 62 | 63 | *) 64 | ;; 65 | esac 66 | done 67 | 68 | return 0 69 | 70 | } 71 | 72 | function bridge_addon_mprun_alteropt { 73 | 74 | ## on se place en mode debug si souhaite 75 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 76 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 77 | then 78 | set -x 79 | fi 80 | 81 | ## on incremente le niveau de log 82 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 83 | 84 | ## on ajoute une entete a la log 85 | typeset LOGGER="${LOGGER} MVAPICH Addon :" 86 | 87 | echo $(which mpicc 2>/dev/null) | tr '/' ' ' | tr '-' ' ' | grep -q mvapich 88 | if [ $? -ne 0 ] 89 | then 90 | return 0 91 | fi 92 | ${LOGGER} "MVAPICH mpicc is the first in the PATH" 93 | 94 | echo ${spmd_run_options} | grep -q '\-\-mpi=mvapich' 95 | if [[ $? -ne 0 ]] 96 | then 97 | export spmd_run_options="${spmd_run_options} --mpi=mvapich" 98 | ${LOGGER} "MVAPICH mode is now enabled" 99 | else 100 | ${LOGGER} "MVAPICH mode is already enabled" 101 | fi 102 | 103 | return 0 104 | 105 | } 106 | 107 | function bridge_addon_mprun_spmd_pre_allocate { 108 | 109 | return 0 110 | 111 | } 112 | 113 | function bridge_addon_mprun_spmd_post_allocate { 114 | 115 | return 0 116 | 117 | } 118 | 119 | function bridge_addon_mprun_spmd_pre_run { 120 | 121 | return 0 122 | 123 | } 124 | 125 | function bridge_addon_mprun_spmd_post_run { 126 | 127 | return 0 128 | 129 | } 130 | -------------------------------------------------------------------------------- /scripts/addons/mvapich2-slurm.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/mvapich2-slurm.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | ################################################################################# 24 | # 25 | # Addon for MVAPICH2 support in Bridge with Slurm 26 | # 27 | # 28 | ################################################################################# 29 | 30 | function bridge_addon_mprun_setopt { 31 | 32 | return 0 33 | 34 | } 35 | 36 | function bridge_addon_mprun_getopt { 37 | 38 | ## on se place en mode debug si souhaite 39 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 40 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 41 | then 42 | set -x 43 | fi 44 | 45 | ## on incremente le niveau de log 46 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 47 | 48 | ## on ajoute une entete a la log 49 | typeset LOGGER="${LOGGER} MVAPICH2 Addon :" 50 | 51 | ## on fixe le status de sortie par defaut 52 | typeset exit_status=0 53 | 54 | ## on parse les arguments 55 | while getopts ${BRIDGE_MPRUN_GETOPT_OPTIONS} option 56 | do 57 | case ${option} in 58 | 59 | h) 60 | return 0 61 | ;; 62 | 63 | *) 64 | ;; 65 | esac 66 | done 67 | 68 | return 0 69 | 70 | } 71 | 72 | function bridge_addon_mprun_alteropt { 73 | 74 | ## on se place en mode debug si souhaite 75 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 76 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 77 | then 78 | set -x 79 | fi 80 | 81 | ## on incremente le niveau de log 82 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 83 | 84 | ## on ajoute une entete a la log 85 | typeset LOGGER="${LOGGER} MVAPICH2 Addon :" 86 | 87 | echo $(which mpicc 2>/dev/null) | grep -q mvapich2 88 | if [ $? -ne 0 ] 89 | then 90 | return 0 91 | fi 92 | ${LOGGER} "MVAPICH2 mpicc is the first in the PATH" 93 | 94 | echo ${spmd_run_options} | grep -q '\-\-mpi=mvapich2' 95 | if [[ $? -ne 0 ]] 96 | then 97 | export spmd_run_cmd="LD_PRELOAD=/usr/lib64/libpmi.so ${spmd_run_cmd}" 98 | export spmd_run_options="${spmd_run_options} --mpi=mvapich" 99 | ${LOGGER} "MVAPICH2 mode is now enabled" 100 | else 101 | ${LOGGER} "MVAPICH2 mode is already enabled" 102 | fi 103 | 104 | return 0 105 | 106 | } 107 | 108 | function bridge_addon_mprun_spmd_pre_allocate { 109 | 110 | return 0 111 | 112 | } 113 | 114 | function bridge_addon_mprun_spmd_post_allocate { 115 | 116 | return 0 117 | 118 | } 119 | 120 | function bridge_addon_mprun_spmd_pre_run { 121 | 122 | return 0 123 | 124 | } 125 | 126 | function bridge_addon_mprun_spmd_post_run { 127 | 128 | return 0 129 | 130 | } 131 | -------------------------------------------------------------------------------- /scripts/addons/preload.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/preload.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2015) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | ################################################################################# 24 | # 25 | # Addon for preload support in Bridge for both msub and mprun 26 | # 27 | ################################################################################# 28 | 29 | ################################################################################# 30 | # MSUB QOS support 31 | #-------------------------------------------------------------------------------- 32 | function bridge_addon_msub_setopt { 33 | 34 | return 0 35 | 36 | } 37 | 38 | function bridge_addon_msub_getopt { 39 | 40 | return 0 41 | } 42 | 43 | function bridge_addon_msub_alteropt { 44 | 45 | return 0 46 | } 47 | 48 | function bridge_addon_msub_alterscript { 49 | 50 | ## Debug mode 51 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 52 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 53 | then 54 | set -x 55 | fi 56 | 57 | ## Increase verbosity level 58 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 59 | 60 | ## Header for log 61 | typeset LOGGER="${LOGGER} Bridge Preload Addon :" 62 | typeset ERROR="${ERROR} Bridge Preload Addon :" 63 | 64 | ## Set LD_PRELOAD only if BRIDGE_MSUB_PRELOAD exist 65 | if [ -n "${BRIDGE_MSUB_PRELOAD}" ] 66 | then 67 | export LD_PRELOAD="${BRIDGE_MSUB_PRELOAD}:${LD_PRELOAD}" 68 | ${LOGGER} "LD_PRELOAD is now ${LD_PRELOAD}" 69 | else 70 | ${LOGGER} "LD_PRELOAD was not modified" 71 | fi 72 | 73 | return 0 74 | } 75 | ################################################################################# 76 | 77 | 78 | ################################################################################# 79 | # MPRUN QOS support 80 | #-------------------------------------------------------------------------------- 81 | function bridge_addon_mprun_setopt { 82 | 83 | return 0 84 | 85 | } 86 | 87 | function bridge_addon_mprun_getopt { 88 | 89 | return 0 90 | } 91 | 92 | function bridge_addon_mprun_alteropt { 93 | 94 | return 0 95 | 96 | } 97 | 98 | function bridge_addon_mprun_spmd_pre_allocate { 99 | 100 | return 0 101 | 102 | } 103 | 104 | function bridge_addon_mprun_spmd_post_allocate { 105 | 106 | return 0 107 | 108 | } 109 | 110 | function bridge_addon_mprun_spmd_pre_run { 111 | 112 | ## Debug mode 113 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 114 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 115 | then 116 | set -x 117 | fi 118 | 119 | ## Increase verbosity level 120 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 121 | 122 | ## Header for log 123 | typeset LOGGER="${LOGGER} Bridge Preload Addon :" 124 | typeset ERROR="${ERROR} Bridge Preload Addon :" 125 | 126 | ## Set LD_PRELOAD only if BRIDGE_MPRUN_PRELOAD exist 127 | if [ -n "${BRIDGE_MPRUN_PRELOAD}" ] 128 | then 129 | export LD_PRELOAD="${BRIDGE_MPRUN_PRELOAD}:${LD_PRELOAD}" 130 | ${LOGGER} "LD_PRELOAD is now ${LD_PRELOAD}" 131 | else 132 | ${LOGGER} "LD_PRELOAD was not modified" 133 | fi 134 | 135 | return 0 136 | 137 | } 138 | 139 | function bridge_addon_mprun_spmd_post_run { 140 | 141 | return 0 142 | 143 | } 144 | ################################################################################# 145 | -------------------------------------------------------------------------------- /scripts/addons/reservation.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/reservation.ad - Add BRIDGE_RESERVATION env var support 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2014) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | ## MSUB 24 | function bridge_addon_msub_setopt { 25 | return 0 26 | } 27 | 28 | function bridge_addon_msub_getopt { 29 | typeset USAGE="\ 30 | \t*) Reservation addon 31 | \t This addon automatically enforces the usage of a particular SLURM reservation 32 | \t when the env variable BRIDGE_RESERVATION is set to the requested value. 33 | \t (note that it only works with SLURM >= 2.6) 34 | \n" 35 | 36 | while getopts ${BRIDGE_MSUB_GETOPT_OPTIONS} option 37 | do 38 | case ${option} in 39 | 40 | h) 41 | echo -e "${USAGE}" >&2 42 | return 0 43 | ;; 44 | 45 | *) 46 | ;; 47 | esac 48 | done 49 | return 0 50 | } 51 | 52 | 53 | function bridge_addon_msub_alteropt { 54 | ## on se place en mode debug si souhaite 55 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 56 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 57 | then 58 | set -x 59 | fi 60 | 61 | ## on incremente le niveau de log 62 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 63 | 64 | ## on ajoute une entete a la log 65 | typeset LOGGER="${LOGGER} Bridge Reservation Addon :" 66 | 67 | if [[ -n ${BRIDGE_RESERVATION} ]]; then 68 | ${LOGGER} "now requesting reservation ${BRIDGE_RESERVATION} usage" 69 | export SBATCH_RESERVATION=${BRIDGE_RESERVATION} 70 | export SLURM_RESERVATION=${BRIDGE_RESERVATION} 71 | fi 72 | 73 | return 0 74 | } 75 | 76 | function bridge_addon_msub_alterscript { 77 | return 0 78 | } 79 | 80 | 81 | 82 | ##MPRUN 83 | function bridge_addon_mprun_setopt { 84 | return 0 85 | } 86 | 87 | function bridge_addon_mprun_getopt { 88 | typeset USAGE="\ 89 | \t*) Reservation addon 90 | \t This addon automatically enforces the usage of a particular SLURM reservation 91 | \t when the env variable BRIDGE_RESERVATION is set to the requested value. 92 | \t (note that it only works with SLURM >= 2.6) 93 | \n" 94 | 95 | while getopts ${BRIDGE_MPRUN_GETOPT_OPTIONS} option 96 | do 97 | case ${option} in 98 | 99 | h) 100 | echo -e "${USAGE}" >&2 101 | return 0 102 | ;; 103 | 104 | *) 105 | ;; 106 | esac 107 | done 108 | return 0 109 | } 110 | 111 | function bridge_addon_mprun_alteropt { 112 | ## on se place en mode debug si souhaite 113 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 114 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 115 | then 116 | set -x 117 | fi 118 | 119 | ## on incremente le niveau de log 120 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 121 | 122 | ## on ajoute une entete a la log 123 | typeset LOGGER="${LOGGER} Bridge Reservation Addon :" 124 | 125 | if [[ -n ${BRIDGE_RESERVATION} ]]; then 126 | ${LOGGER} "now requesting reservation ${BRIDGE_RESERVATION} usage" 127 | export SALLOC_RESERVATION=${BRIDGE_RESERVATION} 128 | export SRUN_RESERVATION=${BRIDGE_RESERVATION} 129 | export SLURM_RESERVATION=${BRIDGE_RESERVATION} 130 | fi 131 | 132 | return 0 133 | } 134 | 135 | function bridge_addon_mprun_spmd_pre_allocate { 136 | return 0 137 | } 138 | 139 | 140 | function bridge_addon_mprun_spmd_post_allocate { 141 | return 0 142 | } 143 | 144 | 145 | function bridge_addon_mprun_spmd_pre_run { 146 | return 0 147 | } 148 | 149 | function bridge_addon_mprun_spmd_post_run { 150 | return 0 151 | } 152 | -------------------------------------------------------------------------------- /scripts/addons/spank-stats.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #*****************************************************************************\ 3 | # scripts/addons/spank-stats.sh - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | 25 | if [[ ${SPANK_STATS_DIGEST} == "yes" ]] || [[ ${SPANK_STATS_DIGEST} == "1" ]] 26 | then 27 | /usr/libexec/spank-stats-script post ${SLURM_JOBID} ${SLURM_STEPID} 28 | fi 29 | -------------------------------------------------------------------------------- /scripts/addons/stdio-flux.ad: -------------------------------------------------------------------------------- 1 | *****************************************************************************\ 2 | # scripts/addons/stdio-flux.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2022) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | #-------------------------------------------------------------------------------- 23 | function bridge_addon_mprun_setopt { 24 | typeset MYGETOPTOPTION="o:e:l:" 25 | echo "${BRIDGE_MPRUN_GETOPT_OPTIONS}" | grep -q ${MYGETOPTOPTION} 26 | if [ $? -ne 0 ] 27 | then 28 | BRIDGE_MPRUN_GETOPT_OPTIONS="${BRIDGE_MPRUN_GETOPT_OPTIONS}o:e:l" 29 | fi 30 | 31 | return 0 32 | } 33 | 34 | function bridge_addon_mprun_getopt { 35 | ## on se place en mode debug si souhaite 36 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 37 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 38 | then 39 | set -x 40 | fi 41 | ## on incremente le niveau de log 42 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 43 | ## on ajoute une entete a la log 44 | typeset LOGGER="${LOGGER} Bridge Stdio flux Addon getopt:" 45 | 46 | ## check user env for stdio_flux 47 | if [[ -n ${BRIDGE_MPRUN_STDIO_FLUX_OUTPUT} ]]; then 48 | BRIDGE_MPRUN_FLUX_STDOUT="${BRIDGE_MPRUN_STDIO_FLUX_OUTPUT}" 49 | fi 50 | 51 | if [[ -n ${BRIDGE_MPRUN_STDIO_FLUX_APPEND} ]]; then 52 | BRIDGE_MPRUN_FLUX_APPEND="${BRIDGE_MPRUN_STDIO_FLUX_APPEND}" 53 | fi 54 | 55 | ## on fixe le message d'aide a afficher si demande 56 | typeset USAGE="\ 57 | \t*) Stdio files with flux 58 | \t\t -o option : flux files stdout\n 59 | \t\t -e option : flux files stderr\n 60 | \t\t -l option : flux add rank labels to stdout, stderr lines \n" 61 | 62 | ## on fixe le status de sortie par defaut 63 | typeset exit_status=0 64 | 65 | 66 | ## on parse les arguments 67 | while getopts ${BRIDGE_MPRUN_GETOPT_OPTIONS} option 68 | do 69 | case ${option} in 70 | 71 | 72 | h) 73 | echo -e "${USAGE}" >&2 74 | return 0 75 | ;; 76 | 77 | o) 78 | BRIDGE_MPRUN_FLUX_STDOUT="${OPTARG}" 79 | ;; 80 | 81 | e) 82 | BRIDGE_MPRUN_FLUX_STDERR="${OPTARG}" 83 | ;; 84 | 85 | l) 86 | BRIDGE_MPRUN_FLUX_LABELIO=1 87 | ;; 88 | 89 | *) 90 | ;; 91 | esac 92 | done 93 | 94 | 95 | return 0 96 | 97 | } 98 | 99 | function bridge_addon_mprun_alteropt { 100 | ## on se place en mode debug si souhaite 101 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 102 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 103 | then 104 | set -x 105 | fi 106 | ## on incremente le niveau de log 107 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 108 | 109 | ## on ajoute une entete a la log 110 | typeset LOGGER="${LOGGER} Bridge Stdio Flux Addon :" 111 | typeset ERROR="${ERROR} Bridge Stdio Flux Addon :" 112 | 113 | 114 | if [[ -n ${BRIDGE_MPRUN_FLUX_STDOUT} ]]; then 115 | spmd_run_extra_parameters+=( "--output=${BRIDGE_MPRUN_FLUX_STDOUT}" ) 116 | fi 117 | 118 | if [[ -n ${BRIDGE_MPRUN_FLUX_STDERR} ]]; then 119 | spmd_run_extra_parameters+=( "--error=${BRIDGE_MPRUN_FLUX_STDERR}" ) 120 | fi 121 | 122 | if [[ -n ${BRIDGE_MPRUN_FLUX_LABELIO} ]]; then 123 | spmd_run_extra_parameters+=( "-l" ) 124 | fi 125 | 126 | return 0 127 | } 128 | 129 | function bridge_addon_mprun_spmd_pre_allocate { 130 | return 0 131 | } 132 | 133 | function bridge_addon_mprun_spmd_post_allocate { 134 | 135 | return 0 136 | 137 | } 138 | 139 | function bridge_addon_mprun_spmd_pre_run { 140 | 141 | return 0 142 | } 143 | 144 | function bridge_addon_mprun_spmd_post_run { 145 | 146 | return 0 147 | } 148 | 149 | -------------------------------------------------------------------------------- /scripts/addons/strace.ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cea-hpc/bridge/088208228e1be4d543c0f4b7f02462353dec4e46/scripts/addons/strace.ad -------------------------------------------------------------------------------- /scripts/addons/strace.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # trace_file=$(mktemp -p "${TMPDIR:-/tmp}" trx_cea_strace_XXX) 3 | # exec 2>${trace_file} ; set -x 4 | : numargs=$# : $@ 5 | 6 | function usage 7 | { 8 | cat <<+++ 9 | usage: $ARGV0 [-o ] [-O ] [-R ] -- command args 10 | -o to write trace outputs under directory (default: home -t) 11 | -O to transmit option to the tracer 12 | -R to trace only some MPI processes 13 | -t to use command instead of strace 14 | 15 | Mpi ranks may be specified 16 | - as a list of numerical ranges 17 | - or using 'nodeset' command synatx with 'mpi' as nodename 18 | 19 | Ex: -R 1-4,8-9 20 | -R mpi[1-4,8-9] 21 | -R 'mpi[1-9]!mpi[5-7]' 22 | trace only MPI rank: 1, 2, 3, 4, 8, 9. 23 | 24 | traces are generated using the following name convention: 25 | \$(home -t)/strace_{JOBID}.{STEPID}/{HOSTNAME}/trx_proc_{MPIRANK} 26 | 27 | +++ 28 | exit 1 29 | } 30 | 31 | # canonicalize a mpi range 32 | # return 1 if any error 33 | canonic() 34 | { 35 | typeset range 36 | if [[ $1 = mpi\[*\] ]] ; then 37 | range="$1" 38 | else 39 | range="mpi[$1]" 40 | fi 41 | # nodeset will generate and check mpi range 42 | nodeset -f $range 2>/dev/null 43 | } 44 | 45 | # check in current mpi process is in the MPI_RANGE 46 | # return 1 if not 47 | i_must_be_traced() 48 | { 49 | (( $(nodeset -c $MPI_RANGE\&mpi$SLURM_PROCID) == 1 )) 50 | } 51 | 52 | # count the number of traced MPI process 53 | # 54 | nb_proc_traced() 55 | { 56 | nodeset -c $MPI_RANGE\&$MPI_ALLPROCS 57 | } 58 | 59 | # 60 | # main 61 | # 62 | # try to guess which command must be used to get scratch directory 63 | if type cea_home >/dev/null 2>&1 ; then 64 | BDIR=$(cea_home -t) 65 | elif type ccc_home >/dev/null 2>&1 ; then 66 | BDIR=$(ccc_home -t) 67 | else 68 | BDIR= 69 | fi 70 | typeset -i errflag=0 71 | typeset ARGV0=${0##*/} # basename de la commande 72 | typeset OPTSTRING=":o:O:R:t:" # liste des options 73 | typeset STRACE_OPTIONS="" # addtional strace options 74 | typeset MPI_ALLPROCS="mpi[0-$((SLURM_NTASKS - 1))]" # all mpi process 75 | typeset MPI_RANGE="$MPI_ALLPROCS" # by default, trace all process 76 | typeset tracer="strace" 77 | # 78 | while getopts $OPTSTRING option 79 | do 80 | case "$option" in 81 | o) BDIR="$OPTARG" ;; 82 | O) STRACE_OPTIONS="$STRACE_OPTIONS $OPTARG" ;; 83 | R) MPI_RANGE="$( canonic $OPTARG )" || { 84 | echo "$ARGV0: syntaxe invalide $OPTARG" >&2 85 | exit 1 86 | } 87 | ;; 88 | t) tracer=$OPTARG ;; 89 | ?) errflag=1 ;; 90 | esac 91 | done 92 | shift $(( OPTIND - 1 )) 93 | if (( (errflag != 0) || ($# == 0) )) ; then 94 | usage 95 | fi 96 | 97 | [[ -z $SLURM_JOB_ID ]] && { 98 | echo "$ARGV0: ERROR: this script must be used with slurm & bridge" >&2 99 | exit 1 100 | } 101 | [[ -z $BDIR ]] && { 102 | echo "$ARGV0: ERROR: no directory specified to put traces" >&2 103 | exit 1 104 | } 105 | (( $(nb_proc_traced) == 0 )) && { 106 | echo "$ARGV0: WARNING, no process will be traced !!!" >&2 107 | } 108 | type $tracer >/dev/null 2>&1 || { 109 | echo "$ARGV0: ERROR, command $tracer not found !!!" >&2 110 | exit 1 111 | } 112 | 113 | 114 | STRACE_DIR=$BDIR/strace_${SLURM_JOB_ID}.${SLURM_STEPID}/$(hostname -s) 115 | STRACE_FILE=$STRACE_DIR/trx_proc_${SLURM_PROCID} 116 | if (( SLURM_PROCID == 0 )) ; then 117 | echo "$ARGV0: INFO: $tracer will be ran on MPI processes $MPI_RANGE, see trace files under $BDIR/strace_${SLURM_JOB_ID}.${SLURM_STEPID}" 118 | fi 119 | if i_must_be_traced ; then 120 | # introduce some asynchronism to create directory 121 | usleep $(( $SLURM_PROCID * 2 )) 122 | [[ -d $STRACE_DIR ]] || mkdir -p $STRACE_DIR 2>/dev/null 123 | exec ${tracer} ${STRACE_OPTIONS} $@ 2>${STRACE_FILE} 124 | else 125 | # execute directly application 126 | exec $@ 127 | fi 128 | -------------------------------------------------------------------------------- /scripts/addons/tagoutput.ad: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/addons/tagoutput.ad - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | ################################################################################# 24 | # 25 | # Addon to provide a way to tag output 26 | # 27 | # 28 | ################################################################################# 29 | 30 | function bridge_addon_mprun_setopt { 31 | 32 | typeset MYGETOPTOPTION="l" 33 | 34 | echo "${BRIDGE_MPRUN_GETOPT_OPTIONS}" | grep -q ${MYGETOPTOPTION} 35 | 36 | if [ $? -ne 0 ] 37 | then 38 | BRIDGE_MPRUN_GETOPT_OPTIONS="${BRIDGE_MPRUN_GETOPT_OPTIONS}l" 39 | fi 40 | 41 | return 0 42 | 43 | } 44 | 45 | function bridge_addon_mprun_getopt { 46 | 47 | ## on se place en mode debug si souhaite 48 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 49 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 50 | then 51 | set -x 52 | fi 53 | 54 | ## on incremente le niveau de log 55 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 56 | 57 | ## on ajoute une entete a la log 58 | typeset LOGGER="${LOGGER} Labelling Addon :" 59 | 60 | ## on fixe le message d'aide a afficher si demande 61 | typeset USAGE="\ 62 | \t*) Labelling 63 | \t\t -l : prepend stdout/stderr lines with correponding tasks information \n\ 64 | \t\t (results depend on underlying launch mechanism and should not\n\ 65 | \t\t be automatically post-processed for that reason) \ 66 | 67 | " 68 | 69 | ## on fixe le status de sortie par defaut 70 | typeset exit_status=0 71 | 72 | ## on parse les arguments 73 | while getopts ${BRIDGE_MPRUN_GETOPT_OPTIONS} option 74 | do 75 | case ${option} in 76 | 77 | h) 78 | echo -e "${USAGE}" >&2 79 | return 0 80 | ;; 81 | 82 | l) 83 | export BRIDGE_LABEL_MODE=1 84 | ${LOGGER} "output tagging enabled" 85 | ;; 86 | 87 | *) 88 | ;; 89 | esac 90 | done 91 | 92 | return 0 93 | 94 | } 95 | 96 | function bridge_addon_mprun_alteropt { 97 | 98 | return 0 99 | 100 | } 101 | 102 | function bridge_addon_mprun_spmd_pre_allocate { 103 | 104 | return 0 105 | 106 | } 107 | 108 | function bridge_addon_mprun_spmd_post_allocate { 109 | 110 | return 0 111 | 112 | } 113 | 114 | function bridge_addon_mprun_spmd_pre_run { 115 | 116 | ## on se place en mode debug si souhaite 117 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 118 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 119 | then 120 | set -x 121 | fi 122 | 123 | ## on incremente le niveau de log 124 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 125 | 126 | ## on ajoute une entete a la log 127 | typeset LOGGER="${LOGGER} Labelling Addon :" 128 | 129 | if [[ ${BRIDGE_LABEL_MODE} -eq 1 ]] 130 | then 131 | 132 | case ${spmd_run_cmd} in 133 | 134 | mpirun) 135 | export spmd_run_options="${spmd_run_options} -tag-output" 136 | ;; 137 | 138 | srun|*) 139 | #export spmd_run_options="${spmd_run_options} -l" 140 | export SLURM_LABELIO=1 141 | ;; 142 | 143 | esac 144 | 145 | fi 146 | 147 | return 0 148 | 149 | } 150 | 151 | function bridge_addon_mprun_spmd_post_run { 152 | 153 | return 0 154 | 155 | } 156 | -------------------------------------------------------------------------------- /scripts/batch_system/Makefile.am: -------------------------------------------------------------------------------- 1 | scriptsdir = $(datadir)/scripts 2 | bsscriptsdir = $(scriptsdir)/batch_system 3 | bspluginsdir = $(bsscriptsdir)/plugins 4 | bsaddonsdir = $(bsscriptsdir)/addons 5 | bsprofilesdir = $(bsscriptsdir)/profiles 6 | 7 | dist_bin_SCRIPTS = msub mstat mdel mpp 8 | 9 | dist_bsplugins_DATA = plugins/generic plugins/lsf plugins/nqsII \ 10 | plugins/slurm plugins/torque plugins/flux 11 | 12 | dist_bsaddons_DATA = 13 | 14 | dist_bsprofiles_DATA = profiles/slurm.sh profiles/lsf.sh \ 15 | profiles/nqsII.sh 16 | -------------------------------------------------------------------------------- /scripts/batch_system/profiles/lsf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #*****************************************************************************\ 3 | # scripts/batch_system/profiles/lsf.sh - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | 25 | export BRIDGE_MSUB_REQID=${LSB_JOBID} 26 | 27 | # not currently defined by LSF 28 | # values will be inherited from msub command 29 | #export BRIDGE_MSUB_NCORE= 30 | #export BRIDGE_MSUB_NNODE= 31 | #export BRIDGE_MSUB_NPROC= 32 | 33 | export BRIDGE_MSUB_QUEUE=${LSB_QUEUE} 34 | export BRIDGE_MSUB_PROJECT=${LSB_UNIXGROUP} 35 | -------------------------------------------------------------------------------- /scripts/batch_system/profiles/nqsII.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #*****************************************************************************\ 3 | # scripts/batch_system/profiles/nqsII.sh - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | 25 | export BRIDGE_MSUB_REQID=${JOBID} 26 | export BRIDGE_MSUB_QUEUE=${PBS_QUEUE} 27 | 28 | # not currently defined by PBS 29 | # values will be inherited from msub command 30 | #export BRIDGE_MSUB_NCORE= 31 | #export BRIDGE_MSUB_NNODE= 32 | #export BRIDGE_MSUB_NPROC= 33 | #export BRIDGE_MSUB_PROJECT= 34 | 35 | 36 | -------------------------------------------------------------------------------- /scripts/batch_system/profiles/slurm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #*****************************************************************************\ 3 | # scripts/batch_system/profiles/slurm.sh - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | 25 | export BRIDGE_MSUB_JOBID=${SLURM_JOB_ID} 26 | export BRIDGE_MSUB_STEPID=${SLURM_STEP_ID} 27 | 28 | export BRIDGE_MSUB_NNODE=${SLURM_NNODES:-1} 29 | export BRIDGE_MSUB_NPROC=${SLURM_NPROCS:-1} 30 | 31 | export BRIDGE_MSUB_QUEUE=$(squeue -o %P -h -j ${SLURM_JOB_ID}) 32 | export BRIDGE_MSUB_PROJECT=$(squeue -o %a -h -j ${SLURM_JOB_ID}) 33 | 34 | # not currently defined by Slurm in batch mode 35 | # values will be inherited from msub command 36 | #export BRIDGE_MSUB_NCORE= 37 | -------------------------------------------------------------------------------- /scripts/common/Makefile.am: -------------------------------------------------------------------------------- 1 | scriptsdir = $(datadir)/scripts 2 | commonscriptsdir = $(scriptsdir)/common 3 | 4 | dist_commonscripts_DATA = bridge_readconf bridge_printer bridge_lock_mgr bridge_command \ 5 | bridge_addon bridge_toolbox 6 | -------------------------------------------------------------------------------- /scripts/common/bridge_addon: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/common/bridge_addon - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | # 24 | # Ce script fournit les primitives de manipulations des addons 25 | # Il necessite la presence de la variable d'environnement 26 | # BRIDGE_RESOURCE_MANAGER_ADDONDIR pour fonctionner 27 | # 28 | # 29 | 30 | # 31 | # cette fonction appelle par ordre alphabetique l'ensemble des fichiers addons 32 | # du repertoire defini par le variable d'environnement BRIDGE_ADDON_DIR 33 | # et execute la commande passee en 1er argument a l'aide des arguements suivant 34 | # 35 | # si un addon renvoie un status different de 0, alors la fonction s'arrete et renvoie ce status 36 | # au programme appelant. Cette fonctionnalite est utilise lorsqu'un addon prend a pris la main 37 | # sur une execution et souhaite avertir le programme appelant qu'il n'est plus necessaire de 38 | # chercher a effectuer une operation 39 | # 40 | function bridge_addons_call_function { 41 | 42 | ## on se place en mode debug si souhaite 43 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 44 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 45 | then 46 | set -x 47 | fi 48 | 49 | ## on incremente le niveau de log 50 | typeset -i BRIDGE_VERBOSE_LEVEL=${BRIDGE_VERBOSE_LEVEL:-0}+1 51 | 52 | typeset rc=0 53 | typeset addon 54 | typeset subfunc 55 | typeset checkfunc 56 | 57 | typeset LOGGER="${LOGGER:-true} Addon Mgr :" 58 | 59 | if [ $# -ge 1 ] && [[ -n ${BRIDGE_ADDON_DIR} ]] 60 | then 61 | 62 | subfunc=$1 63 | shift 64 | 65 | for addon in ${BRIDGE_ADDONS} 66 | do 67 | 68 | ## source addon and execute requested function 69 | unset -f ${subfunc} 70 | if [[ ! -r ${BRIDGE_ADDON_DIR}/${addon} ]] 71 | then 72 | ${LOGGER} "skipping unreadable addon \"${addon}\"" 73 | continue 74 | fi 75 | . ${BRIDGE_ADDON_DIR}/${addon} 2>/dev/null 76 | checkfunc= 77 | typeset +f ${subfunc} >/dev/null 2>&1 78 | if [[ $? -eq 0 ]] 79 | then 80 | ${subfunc} "$@" 81 | else 82 | ${LOGGER} "function ${subfunc} not defined in addon \"${addon}\", skipping" 83 | true 84 | fi 85 | 86 | ## check for requested function status, end loop if non null 87 | rc=$? 88 | if [ ${rc} -ne 0 ] 89 | then 90 | ${LOGGER} "ending loop due to '${addon}' non null return code" 91 | break 92 | fi 93 | 94 | done 95 | 96 | fi 97 | 98 | ## return last executed addon status or the default one (0) 99 | return ${rc} 100 | 101 | } 102 | -------------------------------------------------------------------------------- /scripts/common/bridge_command.in: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/common/bridge_command.in - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | # 24 | # Ce script permet de fixer dans l'environnement les commandes 25 | # fournies par le produit 26 | # Elle transforme les noms par defaut si la configuration du produit l'a 27 | # specifie (--program-prefix,...) 28 | # 29 | 30 | function bridge_command_enhance { 31 | 32 | typeset OUTPUT="" 33 | 34 | if [ $# -eq 0 ] 35 | then 36 | return 0 37 | else 38 | 39 | typeset program_transform_prefix="@program_transform_name@" 40 | if [[ -z ${program_transform_prefix} ]] 41 | then 42 | program_transform_prefix="s,^,," 43 | fi 44 | 45 | for command in $@ 46 | do 47 | OUTPUT="${OUTPUT} $(echo ${command} | sed ${program_transform_prefix})" 48 | done 49 | 50 | echo ${OUTPUT} 51 | return 0 52 | fi 53 | 54 | } 55 | 56 | BRIDGE_BMSTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "bmstat") 57 | BRIDGE_BNSTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "bnstat") 58 | BRIDGE_BQSTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "bqstat") 59 | BRIDGE_BSSTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "bsstat") 60 | 61 | BRIDGE_MSUB_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "msub") 62 | BRIDGE_MSTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "mstat") 63 | BRIDGE_MDEL_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "mdel") 64 | 65 | BRIDGE_RMMSTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "rmmstat") 66 | BRIDGE_RMPSTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "rmpstat") 67 | BRIDGE_RMASTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "rmastat") 68 | 69 | BRIDGE_MPRUN_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "mprun") 70 | BRIDGE_MPSTAT_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "mpstat") 71 | BRIDGE_MPDEL_CMD=${BRIDGE_BINDIR}/$(bridge_command_enhance "mpdel") 72 | -------------------------------------------------------------------------------- /scripts/common/bridge_readconf: -------------------------------------------------------------------------------- 1 | #*****************************************************************************\ 2 | # scripts/common/bridge_readconf - 3 | #****************************************************************************** 4 | # Copyright CEA/DAM/DIF (2012) 5 | # 6 | # This file is part of Bridge, an abstraction layer to ease batch system and 7 | # resource manager usage in heterogeneous HPC environments. 8 | # 9 | # Bridge is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # Bridge is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with Bridge. If not, see 21 | #*****************************************************************************/ 22 | 23 | function bridge_readconf { 24 | 25 | ############################################################### 26 | # On se place en mode verbeux si souhaite 27 | #-------------------------------------------------------------- 28 | typeset -i BRIDGE_DEBUG_LEVEL=${BRIDGE_DEBUG_LEVEL:-0}+1 29 | if [ "${BRIDGE_DEBUG_MODE}" = "yes" ] && [[ ${BRIDGE_DEBUG_LEVEL} -le ${BRIDGE_DEBUG_MAXLEVEL} ]] 30 | then 31 | set -x 32 | fi 33 | 34 | typeset STATUS=2 35 | 36 | typeset CLUSTER=`hostname | sed 's/^cws-//' | sed 's/\([0-9]\)*\(\-.*\)*$//'` 37 | typeset NODE=`hostname` 38 | 39 | typeset NODE_CONF="${NODE}.conf" 40 | typeset CLUSTER_CONF="${CLUSTER}.conf" 41 | typeset DEFAULT_CONF="conf" 42 | 43 | ## le repertoire des confs est defini ou alors /etc 44 | for confdir in ${BRIDGE_CONFDIR} /etc 45 | do 46 | 47 | ## si le nom du programme appelant ou une ou plusieurs categories 48 | ## ont ete definies, alors on tente de sourcer les fichiers de configuration 49 | ## associes 50 | if [[ -n ${PROGNAME} ]] || [[ -n ${BRIDGE_CATEGORIES} ]] 51 | then 52 | for prefix in ${BRIDGE_CATEGORIES} ${PROGNAME} 53 | do 54 | 55 | for suffix in ${DEFAULT_CONF} ${CLUSTER_CONF} ${NODE_CONF} 56 | do 57 | 58 | if [ -r ${confdir}/${prefix}.${suffix} ] 59 | then 60 | . ${confdir}/${prefix}.${suffix} 61 | STATUS=0 62 | fi 63 | 64 | done 65 | 66 | done 67 | fi 68 | 69 | ## break if at least one source was made in a dir 70 | if [[ ${STATUS} -eq 0 ]] 71 | then 72 | break 73 | fi 74 | 75 | done 76 | 77 | return 0 78 | 79 | } 80 | -------------------------------------------------------------------------------- /scripts/common/bridge_toolbox: -------------------------------------------------------------------------------- 1 | #!/bin/ksh 2 | #*****************************************************************************\ 3 | # scripts/common/bridge_toolbox - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | # 25 | # 26 | #-------------------------------------------------------------------------------- 27 | # bridge_tmpfile : creer et affiche un nom de fichier temporaire unique 28 | # a partir de l'argument fournit 29 | # usage : bridge_tmpfile 30 | # retour : nom du fichier temporaire 31 | #-------------------------------------------------------------------------------- 32 | function bridge_tmpfile { 33 | typeset BRIDGE_OUTPUT 34 | typeset template=default 35 | if [ $# -ne 0 ] 36 | then 37 | template=$1 38 | fi 39 | BRIDGE_OUTPUT=$(mktemp ${template}_XXXXXX 2>&1) 40 | if [[ $? -ne 0 ]] 41 | then 42 | ${ERROR} "Impossible de creer le fichier temporaire ${template}_XXXXXX : ${BRIDGE_OUTPUT:--}" 43 | return 1 44 | else 45 | echo ${BRIDGE_OUTPUT} 46 | return 0 47 | fi 48 | } 49 | 50 | ################################################################################################################### 51 | # bridge_get_memlimit : convertit en Mo le parametre d'entree et affiche la valeur obtenue 52 | # usage : bridge_get_memlimit quantite 53 | # retour : quantite en Mo 54 | #------------------------------------------------------------------------------------------------------------------ 55 | function bridge_get_memlimit { 56 | integer VALUE 57 | integer MEM 58 | VALUE=`echo $1 | tr -d "[a-z][A-Z]"` 59 | UNITE=`echo $1 | tr -d "[0-9]"` 60 | case "$UNITE" in 61 | ko | Ko | kO | KO ) MEM=$VALUE/1024 ;; 62 | kw | Kw | kW | KW ) MEM=$VALUE*8/1024 ;; 63 | "" | mo | Mo | mO | MO | mb | Mb | MB | mB ) MEM=$VALUE ;; 64 | mw | Mw | mW | MW ) MEM=$VALUE*8 ;; 65 | go | Go | gO | GO ) MEM=$VALUE*1024 ;; 66 | gw | Gw | GW | Gw ) MEM=$VALUE*1024*8 ;; 67 | *) MEM=-1 ;; 68 | esac 69 | echo $MEM 70 | } 71 | -------------------------------------------------------------------------------- /scripts/resource_manager/Makefile.am: -------------------------------------------------------------------------------- 1 | scriptsdir = $(datadir)/scripts 2 | rmscriptsdir = $(scriptsdir)/resource_manager 3 | rmpluginsdir = $(rmscriptsdir)/plugins 4 | rmaddonsdir = $(rmscriptsdir)/addons 5 | rmprofilesdir = $(rmscriptsdir)/profiles 6 | 7 | 8 | dist_bin_SCRIPTS = mprun mpstat mpinfo 9 | 10 | dist_rmplugins_DATA = plugins/generic plugins/slurm plugins/nqsII plugins/rms \ 11 | plugins/torque plugins/ws plugins/lsf plugins/flux 12 | 13 | dist_rmaddons_DATA = addons/get_task_info 14 | 15 | dist_rmprofiles_DATA = profiles/slurm.sh profiles/rms.sh 16 | -------------------------------------------------------------------------------- /scripts/resource_manager/addons/get_task_info: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | #*****************************************************************************\ 3 | # scripts/resource_manager/addons/get_task_info - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | 25 | HOST=$(/bin/hostname) 26 | TASK_SELECTION=MPI_TASKS_ONLY 27 | SHOW=TASK_USAGE 28 | 29 | while getopts aM: option 30 | do 31 | case ${option} in 32 | 33 | a) TASK_SELECTION=ALL_TASKS 34 | ;; 35 | 36 | M) SHOW=MEM_USAGE 37 | MEMLIM=${OPTARG} 38 | ;; 39 | 40 | *) 41 | break 42 | ;; 43 | esac 44 | done 45 | shift $(($OPTIND - 1)) 46 | JOBID=$1 47 | if [ "$JOBID" = "" ] ;then 48 | echo "$0 : jobid non specifie" >&2 49 | exit 1 50 | fi 51 | 52 | LASTREC= 53 | NBTASKS= 54 | 55 | typeset -i Task_Count=0 56 | typeset -i VmPeak= 57 | typeset -i VmSize= 58 | typeset -i VmRSS= 59 | typeset -i Total_VmSize= 60 | typeset -i Total_VmRSS= 61 | 62 | 63 | if [ "$TASK_SELECTION" = "MPI_TASKS_ONLY" ] ;then 64 | echo "MPI_RK LOC_RK PID VmPEAK VmSIZE VmRSS ST CPUs" 65 | echo "------ ------ ----- ------ ------ ----- -- ----" 66 | fi 67 | 68 | scontrol listpids $JOBID | sed '1d' | sort | while [ "$LASTREC" != 1 ] 69 | do 70 | read PID JOBID STEPID LOCALID GLOBALID 71 | if [ $? != 0 ] ; then 72 | if [ "$TASK_SELECTION" = "ALL_TASKS" -a "$SHOW" = "MEM_USAGE" ] ;then 73 | printf "%-12s %7d %7d %7d\n" $HOST $MEMLIM $Total_VmRSS $(expr $MEMLIM - $Total_VmRSS) 74 | fi 75 | LASTREC=1 76 | continue 77 | fi 78 | eval $(cat /proc/$PID/environ 2>/dev/null | tr -s "\0" "\n" | egrep "OMPI_COMM|SLURM_PROCID|SLURM_LOCALID|SLURM_CPUS_ON_NODE" | tr -s "\n" ";" ) 79 | if [ "$OMPI_COMM_WORLD_RANK" != "" ] ;then # lancement salloc + mpirun 80 | printf "%6s %4s %6s " $OMPI_COMM_WORLD_RANK $OMPI_COMM_WORLD_LOCAL_RANK $PID 81 | NBTASKS= 82 | else # lancement srun 83 | if [ "$TASK_SELECTION" = "MPI_TASKS_ONLY" ] ;then 84 | ### processus dont il ne faut pas tenir compte 85 | if [ "$PID" = "-1" ] ;then continue ; fi 86 | if [ "$LOCALID" = "-" ] ;then continue ; fi 87 | if [ "$STEPID" = "batch" ] ;then continue ; fi 88 | case "$(readlink /proc/$PID/exe)" in 89 | *auks | /bin/bash* | /bin/ksh* | orterun | mpirun | srun | "" ) 90 | continue ;; # pour skipper auks 91 | */orted ) 92 | continue ;; 93 | esac 94 | printf "%6s %4s %6s " $SLURM_PROCID $SLURM_LOCALID $PID 95 | NBTASKS=$SLURM_CPUS_ON_NODE 96 | fi 97 | fi 98 | 99 | eval $(cat /proc/$PID/status | egrep "VmPeak:|State:|VmSize:|VmRSS:|Cpus_allowed_list:" | awk '{print $1,$2}' | tr -d " " | tr -s ":" "=") 100 | VmPeak=$VmPeak/1000 101 | VmSize=$VmSize/1000 102 | VmRSS=$VmRSS/1000 103 | Total_VmSize=$Total_VmSize+$VmSize 104 | Total_VmRSS=$Total_VmRSS+$VmRSS 105 | if [ "$SHOW" = "TASK_USAGE" ] ; then 106 | printf "%6d %6d %6d %3s %s\n" $VmPeak $VmSize $VmRSS $State $Cpus_allowed_list 107 | fi 108 | Task_Count=$Task_Count+1 109 | if [ "$TASK_SELECTION" = "MPI_TASKS_ONLY" ] ;then 110 | if [ "$NBTASKS" = "$Task_Count" ] ;then 111 | echo " ------ ------ " 112 | printf "Total %6d %6d \n" $Total_VmSize $Total_VmRSS 113 | LASTREC=1 114 | fi 115 | fi 116 | done 117 | -------------------------------------------------------------------------------- /scripts/resource_manager/profiles/rms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #*****************************************************************************\ 3 | # scripts/resource_manager/profiles/rms.sh - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | 25 | export BRIDGE_MPRUN_JOBID=${RMS_RESOURCE} 26 | export BRIDGE_MPRUN_STEPID=${RMS_JOBID} 27 | 28 | export BRIDGE_MPRUN_NNODE=${RMS_NNODES} 29 | export BRIDGE_MPRUN_NPROC=${RMS_NPROCS} 30 | export BRIDGE_MPRUN_NCORE=${RMS_NCPUS} 31 | 32 | export BRIDGE_MPRUN_QUEUE=${RMS_PARTITION} 33 | 34 | export BRIDGE_MPRUN_NODEID=${RMS_NODEID} 35 | export BRIDGE_MPRUN_PROCID=${RMS_LOCALID} 36 | export BRIDGE_MPRUN_RANKID=${RMS_PROCID} 37 | 38 | # not set in RMS 39 | # values will be inherited from mprun command 40 | #export BRIDGE_MPRUN_PROJECT= 41 | -------------------------------------------------------------------------------- /scripts/resource_manager/profiles/slurm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #*****************************************************************************\ 3 | # scripts/resource_manager/profiles/slurm.sh - 4 | #****************************************************************************** 5 | # Copyright CEA/DAM/DIF (2012) 6 | # 7 | # This file is part of Bridge, an abstraction layer to ease batch system and 8 | # resource manager usage in heterogeneous HPC environments. 9 | # 10 | # Bridge is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Bridge is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Bridge. If not, see 22 | #*****************************************************************************/ 23 | 24 | 25 | export BRIDGE_MPRUN_REQID=${SLURM_JOB_ID} 26 | 27 | export BRIDGE_MPRUN_NNODE=${SLURM_NNODES} 28 | export BRIDGE_MPRUN_NPROC=${SLURM_NPROCS} 29 | export BRIDGE_MPRUN_NCORE=${SLURM_CPUS_PER_TASK} 30 | 31 | # Do not use squeue here to get information as it could 32 | # severely limit the scalability of large jobs using 33 | # this profile and/or overload the slurm controller 34 | # when used by too much jobs simultaneously 35 | # (MPMD script use it a lot) 36 | # 37 | # Use inherited MSUB variables if available instead 38 | # 39 | #export BRIDGE_MPRUN_QUEUE=$(squeue -o %R -h -j ${SLURM_JOB_ID}) 40 | #export BRIDGE_MPRUN_PROJECT=$(squeue -o %a -h -j ${SLURM_JOB_ID}) 41 | export BRIDGE_MPRUN_QUEUE=${BRIDGE_MSUB_QUEUE} 42 | export BRIDGE_MPRUN_PROJECT=${BRIDGE_MSUB_PROJECT} 43 | 44 | export BRIDGE_MPRUN_NODEID=${SLURM_NODEID} 45 | 46 | export BRIDGE_MPRUN_PROCID=${SLURM_LOCALID} 47 | if [[ -n ${OMPI_COMM_WORLD_LOCAL_RANK} ]] 48 | then 49 | export BRIDGE_MPRUN_PROCID=${OMPI_COMM_WORLD_LOCAL_RANK} 50 | fi 51 | 52 | export BRIDGE_MPRUN_RANKID=${SLURM_PROCID} 53 | if [[ -n ${OMPI_COMM_WORLD_RANK} ]] 54 | then 55 | export BRIDGE_MPRUN_RANKID=${OMPI_COMM_WORLD_RANK} 56 | fi 57 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = bridge bridged bridgedc helpers 2 | -------------------------------------------------------------------------------- /src/bridge/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -D_THREAD_SAFE -I$(top_srcdir)/lib -pthread 2 | AM_LDFLAGS = $(top_srcdir)/lib/bridge/libbridge.la -ldl -pthread 3 | 4 | bin_PROGRAMS = idlist nodelist \ 5 | bmstat bsstat bqstat bnstat \ 6 | rmmstat rmpstat rmastat 7 | 8 | idlist_SOURCES = idlist.c 9 | nodelist_SOURCES = nodelist.c 10 | 11 | bmstat_SOURCES = bmstat.c 12 | bsstat_SOURCES = bsstat.c 13 | bqstat_SOURCES = bqstat.c 14 | bnstat_SOURCES = bnstat.c 15 | 16 | rmmstat_SOURCES = rmmstat.c 17 | rmpstat_SOURCES = rmpstat.c 18 | rmastat_SOURCES = rmastat.c 19 | rmastat_LDADD = -lm 20 | -------------------------------------------------------------------------------- /src/bridge/idlist.c: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * src/bridge/idlist.c - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include "bridge/bridge.h" 32 | 33 | #define PROG_VERSION "1.0.1" 34 | 35 | extern int optind; 36 | 37 | int main(int argc,char** argv){ 38 | 39 | int fstatus=-1; 40 | int status; 41 | 42 | FILE* stream=stdout; 43 | 44 | int compacted_mode=1; 45 | int extended_mode=0; 46 | int enum_mode=0; 47 | 48 | char* progname; 49 | char* cb_version; 50 | char* options_desc= 51 | "\t-h\t\t\tPrint this message\n" 52 | "\t-c\t\t\tShow compacted ids list\n" 53 | "\t-e\t\t\tShow extended ids list\n" 54 | "\t-n\t\t\tShow ids quantity\n" 55 | "\t-V\t\t\tPrint bridge and app versions and exit\n"; 56 | 57 | char * optstring="hcenV"; 58 | int option; 59 | 60 | progname=strrchr(argv[0],'/'); 61 | if(progname==NULL) 62 | { 63 | progname=argv[0]; 64 | } 65 | else 66 | { 67 | progname++; 68 | } 69 | 70 | while((option = getopt(argc,argv,optstring)) != -1) { 71 | switch(option){ 72 | case 'c' : 73 | compacted_mode=1; 74 | break; 75 | case 'e' : 76 | extended_mode=1; 77 | break; 78 | case 'n' : 79 | enum_mode=1; 80 | break; 81 | case 'V' : 82 | cb_version=bridge_version(); 83 | if(cb_version!=NULL) 84 | fprintf(stdout,"%s version %s (bridge-%s)\n",progname,PROG_VERSION,cb_version); 85 | else 86 | fprintf(stdout,"%s version %s (bridge-unknown)\n",progname,PROG_VERSION); 87 | goto exit; 88 | break; 89 | case 'h' : 90 | default : 91 | fprintf(stream,"\nUsage : %s [-h] [-cen] id id idlist ... \n\n",argv[0]); 92 | fprintf(stream,"%s\n",options_desc); 93 | goto exit; 94 | } 95 | } 96 | 97 | bridge_idlist_t idlist; 98 | 99 | status=bridge_idlist_init(&idlist,&argv[optind],argc-optind); 100 | if(status){ 101 | fprintf(stderr,"Unable to init ids list\n"); 102 | } 103 | else{ 104 | char* output_string; 105 | 106 | long int quantity=bridge_idlist_ids_quantity(&idlist); 107 | 108 | if(enum_mode){ 109 | fprintf(stream,"%ld\n",quantity); 110 | } 111 | else if(!extended_mode){ 112 | if(bridge_idlist_get_compacted_string(&idlist,&output_string)==0){ 113 | fprintf(stream,"%s\n",output_string); 114 | free(output_string); 115 | } 116 | } 117 | else{ 118 | if(bridge_idlist_get_extended_string(&idlist,&output_string)==0){ 119 | fprintf(stream,"%s\n",output_string); 120 | free(output_string); 121 | } 122 | } 123 | 124 | bridge_idlist_free_contents(&idlist); 125 | } 126 | 127 | 128 | 129 | exit : 130 | 131 | return fstatus; 132 | 133 | } 134 | -------------------------------------------------------------------------------- /src/bridge/nodelist.c: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * src/bridge/nodelist.c - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include "bridge/bridge.h" 32 | 33 | #define PROG_VERSION "1.0.1" 34 | 35 | extern int optind; 36 | 37 | int main(int argc,char** argv){ 38 | 39 | int fstatus=-1; 40 | int status; 41 | 42 | FILE* stream=stdout; 43 | 44 | int compacted_mode=1; 45 | int extended_mode=0; 46 | int enum_mode=0; 47 | 48 | char* progname; 49 | char* cb_version; 50 | char* options_desc= 51 | "\t-h\t\t\tPrint this message\n" 52 | "\t-c\t\t\tShow compacted nodes list\n" 53 | "\t-e\t\t\tShow extended nodes list\n" 54 | "\t-n\t\t\tShow nodes quantity\n" 55 | "\t-V\t\t\tPrint bridge and app versions and exit\n"; 56 | 57 | char * optstring="hcenV"; 58 | int option; 59 | 60 | progname=strrchr(argv[0],'/'); 61 | if(progname==NULL) 62 | { 63 | progname=argv[0]; 64 | } 65 | else 66 | { 67 | progname++; 68 | } 69 | 70 | while((option = getopt(argc,argv,optstring)) != -1) { 71 | switch(option){ 72 | case 'c' : 73 | compacted_mode=1; 74 | break; 75 | case 'e' : 76 | extended_mode=1; 77 | break; 78 | case 'n' : 79 | enum_mode=1; 80 | break; 81 | case 'V' : 82 | cb_version=bridge_version(); 83 | if(cb_version!=NULL) 84 | fprintf(stdout,"%s version %s (bridge-%s)\n",progname,PROG_VERSION,cb_version); 85 | else 86 | fprintf(stdout,"%s version %s (bridge-unknown)\n",progname,PROG_VERSION); 87 | goto exit; 88 | break; 89 | case 'h' : 90 | default : 91 | fprintf(stream,"\nUsage : %s [-h] [-cen] nodename nodename nodeslist ... \n\n",argv[0]); 92 | fprintf(stream,"%s\n",options_desc); 93 | goto exit; 94 | } 95 | } 96 | 97 | bridge_nodelist_t nodelist; 98 | 99 | status=bridge_nodelist_init(&nodelist,&argv[optind],argc-optind); 100 | if(status){ 101 | fprintf(stderr,"Unable to init nodes list\n"); 102 | } 103 | else{ 104 | // fprintf(stream,"Nodes quantity : %u\n",bridge_nodelist_nodes_quantity(&nodelist)); 105 | 106 | char* output_string; 107 | 108 | if(enum_mode){ 109 | fprintf(stream,"%ld\n",bridge_nodelist_nodes_quantity(&nodelist)); 110 | } 111 | else if(!extended_mode){ 112 | if(bridge_nodelist_get_compacted_string(&nodelist,&output_string)==0){ 113 | fprintf(stream,"%s\n",output_string); 114 | free(output_string); 115 | } 116 | } 117 | else{ 118 | if(bridge_nodelist_get_extended_string(&nodelist,&output_string)==0){ 119 | fprintf(stream,"%s\n",output_string); 120 | free(output_string); 121 | } 122 | } 123 | 124 | bridge_nodelist_free_contents(&nodelist); 125 | } 126 | 127 | exit : 128 | 129 | return fstatus; 130 | 131 | } 132 | -------------------------------------------------------------------------------- /src/bridged/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -D_THREAD_SAFE -I$(top_srcdir)/lib -pthread \ 2 | -DBRIDGED_CONF=\"$(sysconfdir)/bridged.conf\" 3 | AM_LDFLAGS = -pthread 4 | 5 | LIBBRIDGEDAPI = $(top_srcdir)/lib/bridged/libbridgedapi.la 6 | 7 | sbin_PROGRAMS = bridged 8 | 9 | noinst_HEADERS = bridged_engine.h \ 10 | worker.h 11 | 12 | bridged_SOURCES = bridged_engine.c bridged.c \ 13 | worker.c 14 | 15 | bridged_LDADD = $(LIBBRIDGEDAPI) 16 | -------------------------------------------------------------------------------- /src/bridged/bridged_engine.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * src/bridged/bridged_engine.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | /** 24 | * \file bridged_engine.h 25 | * \author M. Hautreux 26 | * \date 07/01/2008 27 | * \brief Bridge daemon engine headers 28 | */ 29 | #ifndef __BRIDGED_ENGINE_H_ 30 | #define __BRIDGED_ENGINE_H_ 31 | 32 | /*! \addtogroup BRIDGE_DAEMON 33 | * @{ 34 | */ 35 | 36 | /*! \addtogroup BRIDGED_ENGINE 37 | * @{ 38 | */ 39 | 40 | #ifndef BRIDGED_CONF 41 | #define BRIDGED_CONF "/etc/bridged.conf" 42 | #endif 43 | 44 | typedef struct bridged_engine { 45 | 46 | char* config_file; 47 | 48 | char* address;//!< server hostname or address 49 | char* port;//!< server service name or port 50 | 51 | char* cachedir;//!< directory used for temporary data storage 52 | time_t timeout; //!< timeout to use during transmission 53 | 54 | int worker_nb;//!< number of worker thread (default is 2, one collector and one request processor) 55 | int queue_size;//!< request queue length 56 | 57 | char* logfile;//!< log messages go to this file (NULL means no log) 58 | int loglevel;//!< log level 59 | char* debugfile;//!< debug messages go to this file (NULL means no debug) 60 | int debuglevel;//!< debug level 61 | 62 | } bridged_engine_t; 63 | 64 | /*! 65 | * \brief initialize bridged engine structure 66 | * \internal 67 | * 68 | * \param engine pointer on the structure to initialize 69 | * 70 | * \param config_file string representing the configuration file 71 | * 72 | * \param address address to use 73 | * \param port port to use 74 | * 75 | * \param cachedir directory that contains cached data 76 | * \param timeout timeout in seconds of communication stages 77 | * 78 | * \param logfile file that wil be used to store verbosity 79 | * \param loglevel verbosity level 80 | * 81 | * \param debugfile file that wil be used to store debug data 82 | * \param debuglevel debug level 83 | * 84 | * \param worker_nb quantity of worker threads to launch 85 | * \param queue_size length of the queue that stores incoming socket 86 | * 87 | * \retval 0 on success 88 | * \retval -1 on failure 89 | * \retval -2 on failure due to conf file save 90 | * 91 | */ 92 | int 93 | bridged_engine_init(bridged_engine_t* engine, 94 | char* config_file, 95 | char* address, 96 | char* port, 97 | char* cachedir, 98 | time_t timeout, 99 | char* logfile, 100 | int loglevel, 101 | char* debugfile, 102 | int debuglevel, 103 | int worker_nb, 104 | int queue_size); 105 | 106 | /*! 107 | * \brief initialize bridged engine structure from a configuration file 108 | * \internal 109 | * 110 | * \param engine pointer on the structure to initialize 111 | * 112 | * \param conf_file configuration file to use 113 | * 114 | * \retval 0 on success 115 | * \retval -1 on failure 116 | * 117 | */ 118 | int 119 | bridged_engine_init_from_config_file(bridged_engine_t* engine,char* conf_file); 120 | 121 | 122 | /*! 123 | * \brief free bridged engine structure contents 124 | * \internal 125 | * 126 | * \param engine pointer on the structure to initialize 127 | * 128 | * \retval 0 on success 129 | * \retval -1 on failure 130 | * 131 | */ 132 | int 133 | bridged_engine_free_contents(bridged_engine_t* engine); 134 | 135 | /*! 136 | * @} 137 | */ 138 | 139 | /*! 140 | * @} 141 | */ 142 | 143 | #endif 144 | -------------------------------------------------------------------------------- /src/bridged/worker.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * src/bridged/worker.h - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #ifndef __BRIDGED_WORKER_H_ 24 | #define __BRIDGED_WORKER_H_ 25 | 26 | #include "bridged_engine.h" 27 | 28 | #include "xternal/xqueue.h" 29 | #include "bridged/bridge_rus.h" 30 | 31 | typedef struct bridged_worker_args { 32 | 33 | pthread_t thread; 34 | 35 | int id; 36 | bridged_engine_t* engine; 37 | 38 | xqueue_t* socket_queue; 39 | 40 | bridge_rus_mgr_t* rus_mgr; 41 | 42 | } bridged_worker_args_t; 43 | 44 | int worker_process_request(void* p_args,int socket); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/bridgedc/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -D_THREAD_SAFE -I$(top_srcdir)/lib -pthread \ 2 | -DBRIDGED_CONF=\"$(sysconfdir)/bridged.conf\" 3 | AM_LDFLAGS = -pthread 4 | 5 | LIBBRIDGEDAPI = $(top_srcdir)/lib/bridged/libbridgedapi.la 6 | 7 | bin_PROGRAMS = bridgedc 8 | 9 | bridgedc_SOURCES = bridgedc.c 10 | 11 | bridgedc_LDADD = $(LIBBRIDGEDAPI) 12 | -------------------------------------------------------------------------------- /src/bridgedc/bridgedc.c: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * src/bridgedc/bridgedc.c - 3 | ***************************************************************************** 4 | * Copyright CEA/DAM/DIF (2012) 5 | * 6 | * This file is part of Bridge, an abstraction layer to ease batch system and 7 | * resource manager usage in heterogeneous HPC environments. 8 | * 9 | * Bridge is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * Bridge is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with Bridge. If not, see 21 | \*****************************************************************************/ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | 30 | #include "xternal/xlogger.h" 31 | #include "bridged/bridgedapi.h" 32 | 33 | #define PING_REQUEST 1 34 | #define GET_REQUEST 2 35 | 36 | #define VERBOSE xverbose 37 | #define ERROR xerror 38 | 39 | int main(int argc,char** argv){ 40 | 41 | int fstatus=-1; 42 | 43 | /* options processing variables */ 44 | char* progname; 45 | int option; 46 | char* optstring="dvhf:pgb:r:"; 47 | char* short_options_desc="\nUsage : %s [-h] [-dv] [-f conffile] [-b batchid] [-r rmid] [-p|g]\n\n"; 48 | char* addon_options_desc="\ 49 | \t-h\t\tshow this message\n\ 50 | \t-d\t\tincrease debug level\n\ 51 | \t-v\t\tincrease verbose level\n\ 52 | \t-f conffile\tConfiguration file\n\ 53 | \t-b batchid\tBatch session identifier\n\ 54 | \t-r rmid\t\tResource manager job identifier\n\ 55 | \t-p\t\tping request (default)\n\ 56 | \t-g\t\tget request\n\n"; 57 | 58 | /* local variables */ 59 | char* conf_file_string=NULL; 60 | char* batchid=NULL; 61 | char* rmid=NULL; 62 | 63 | /* request output values */ 64 | time_t used,usable,halt; 65 | 66 | int debug_level=0; 67 | int verbose_level=0; 68 | 69 | int action=PING_REQUEST; 70 | 71 | /* get current program name */ 72 | progname=rindex(argv[0],'/'); 73 | if(progname==NULL) 74 | progname=argv[0]; 75 | else 76 | progname++; 77 | 78 | /* process options */ 79 | while((option = getopt(argc,argv,optstring)) != -1) 80 | { 81 | switch(option) 82 | { 83 | case 'v' : 84 | verbose_level++; 85 | break; 86 | case 'd' : 87 | debug_level++; 88 | break; 89 | case 'f' : 90 | conf_file_string=strdup(optarg); 91 | break; 92 | case 'b' : 93 | batchid=strdup(optarg); 94 | if(batchid==NULL){ 95 | fprintf(stderr,"memory allocation error!"); 96 | return 1; 97 | } 98 | break; 99 | case 'r' : 100 | rmid=strdup(optarg); 101 | if(rmid==NULL){ 102 | fprintf(stderr,"memory allocation error!"); 103 | return 1; 104 | } 105 | break; 106 | case 'p' : 107 | action=PING_REQUEST; 108 | break; 109 | case 'g' : 110 | action=GET_REQUEST; 111 | break; 112 | case 'h' : 113 | default : 114 | fprintf(stdout,short_options_desc,progname); 115 | fprintf(stdout,"%s\n",addon_options_desc); 116 | exit(0); 117 | break; 118 | } 119 | } 120 | 121 | /* set verbosity and debug level */ 122 | xdebug_setmaxlevel(debug_level); 123 | xverbose_setmaxlevel(verbose_level); 124 | 125 | switch(action){ 126 | 127 | case GET_REQUEST : 128 | fstatus = bridgedapi_get(conf_file_string,batchid,rmid, 129 | &usable,&used,&halt); 130 | if ( fstatus == 0 ) { 131 | fprintf(stdout,"used=%ld usable=%ld halt=%ld\n", 132 | used,usable,halt); 133 | } 134 | else { 135 | fprintf(stderr,"unable to process get request\n"); 136 | } 137 | break; 138 | 139 | case PING_REQUEST : 140 | default : 141 | fstatus=bridgedapi_ping(conf_file_string); 142 | if ( fstatus != 0 ) { 143 | fprintf(stderr,"unable to process ping request\n"); 144 | } 145 | break; 146 | 147 | } 148 | 149 | if(batchid!=NULL) 150 | free(batchid); 151 | 152 | if(rmid!=NULL) 153 | free(rmid); 154 | 155 | return fstatus; 156 | 157 | } 158 | -------------------------------------------------------------------------------- /src/helpers/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = mpmd_wrapper 2 | 3 | mpmd_wrapper_SOURCES = bridge.mpmd.wrapper.c bridge.mpmd.wrapper.logic.c 4 | mpmd_wrapper_CPPFLAGS = -g 5 | -------------------------------------------------------------------------------- /src/helpers/bridge.mpmd.wrapper.c: -------------------------------------------------------------------------------- 1 | /* 2 | * bridge.mpmd.wrapper.c - Bridge command wrapper for MPMD launch 3 | * 4 | * > For Totalview, a parallel job debugger from 5 | * TotalView Technologies, LLC 6 | * Type "Shift+G" or click "Play" to start the program 7 | * 8 | * Note that you will be requested to validate to stop the different 9 | * exec'd binaries sequentially. 10 | * 11 | */ 12 | 13 | extern int bridge_mpmd_wrapper(int argc, char** argv); 14 | 15 | int main(int argc, char** argv) 16 | { 17 | return bridge_mpmd_wrapper(argc,argv); 18 | } 19 | --------------------------------------------------------------------------------