📄 paracomp-demo-hpxc.sh
字号:
#!/bin/bash# ___ ___ ___ ___ ___ # /\__\ ___ /\__\ /\ \ /\__\ /\ \ # /::| | /\ \ /::| | /::\ \ /:/ / /::\ \ # /:|:| | \:\ \ /:|:| | /:/\:\ \ /:/ / /:/\:\ \ # /:/|:|__|__ /::\__\ /:/|:| |__ /:/ \:\ \ /:/ / /::\~\:\ \ # /:/ |::::\__\ __/:/\/__/ /:/ |:| /\__\ /:/__/_\:\__\ /:/__/ /:/\:\ \:\__\# \/__/~~/:/ / /\/:/ / \/__|:|/:/ / \:\ /\ \/__/ \:\ \ \:\~\:\ \/__/# /:/ / \::/__/ |:/:/ / \:\ \:\__\ \:\ \ \:\ \:\__\ # /:/ / \:\__\ |::/ / \:\/:/ / \:\ \ \:\ \/__/ # /:/ / \/__/ /:/ / \::/ / \:\__\ \:\__\ # \/__/ \/__/ \/__/ \/__/ \/__/ ## ==============================================================================# Minimalist OpenGL Environment# Parallel Rendering Extension# ==============================================================================## Copyright 2007 Balazs Domonkos# # This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.# # This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# # You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.## Startup script for Hewlett-Packard XC# export theProgramName=${0##*/}export theUpperProgramName=`echo $theProgramName|tr a-z A-Z`export theProgramVersion="E1.0.002"#------------------------------------------------------------------------------# Module header and display function for helpDisplayHelp() { echo "This is the help"}# Display function for module usagesvaDisplayUsage() { echo "Usage: ${theProgramName} -r <n> [-p <name>] [-g <geometry>]"} # Initialize the SVA data. This sets the temporary data file name# which is used until the job is allocated.. svainitif [[ $? -ne 0 ]]; then svaDisplayError "Unable to perform SVA initialization." exitfiif [[ -z "${SLURM_JOBID}" ]]; then # Setup job default from user configuration files if they exist svaGetJobDefaults export DMX_INPUT_SERVER=$DISPLAY SVA_Render_Count=0 SVA_Display_Surface=""fiSVA_Local_Display=1 # Don't set this and SVA will try to allocate a display surface... SVA_Render_Count=1 # Minimum 1 node to show compositing, this makes it possible to run the script without args_PC_Executable="./paracomp-demo"# Process Command-Line optionswhile [[ -n "$1" ]]; do case "$1" in "--help" | "-h" | "-?") DisplayHelp exit ;; "--usage" | "-u") svaDisplayUsage exit ;; "--version" | "-V") svaDisplayVersion exit ;; "--verbose" | "-v") SVA_Verbose_Flag=1 shift continue ;; "--display_surface" | "-d") shift SVA_Display_Surface="$1" shift continue ;; "--render" | "-r") shift SVA_Render_Count=$1 shift continue ;; "--partition" | "-p") shift SVA_Partition_Name=$1 shift continue ;; "--tile_geometry" | "-g") shift SVA_Tile_Geometry=$1 shift continue ;; esac # The value in $1 isn't a local option, so break out of the processing breakdone# Validate command options. If it fails, display a usage message and exitsvaValidateOptionsif [[ ${SVA_Command_Line} != "" ]] ; then echo "Extra options or arguments" svaDisplayUsage exit 1fiif [[ ${SVA_Usage_Error} -ne 0 ]]; then svaDisplayUsage exitfiif [[ -x ${_PC_Executable} ]] ; then echo "running ${_PC_Executable}"else echo "program ${_PC_Executable} missing - run make to create it" exitfi##### JOB PHASE 1: Allocate resources for the job.# This will allocate Render resources for the job.####svaAllocateJobsvaDisplayVerbose "render count: ${SVA_Render_Count}"svaDisplayVerbose "display res: ${SVA_Tile_Geometry}"##### JOB PHASE 2: Launch basic services. This launches X servers.# The application is not launched during this phase.##### Detect if we are running in a TurboVNC or VirtualGL session,echo ${LD_PRELOAD}|grep librrfaker >/dev/nullif [ $? -eq 0 ] ; then SVA_TurboVNC_Session=1fi# The X servers should not load the fake gl library, so remove# it from preloadif [ ${SVA_TurboVNC_Session:-0} -eq 1 ] ; then LD_PRELOAD_STATE=${LD_PRELOAD} export LD_PRELOAD=`echo ${LD_PRELOAD}| sed -e 's/librrfaker.so//g;s/libdlfaker.so//g'`fi# Start X Servers on display and render hosts,export SVA_X_Options="-ac ${SVA_X_Options}"export SVA_XServer_Delay=1svaDisplayVerbose "Start X servers"svaRunDisplayXServers -nowaitsvaRunRenderXServers -nowait# Wait for all of the X servers on display nodes to start upsvaRunDisplayHosts sva_wait_for_X.sh :0# Wait for all of the X servers on render nodes to start upsvaRunRenderHosts sva_wait_for_X.sh :0##### JOB PHASE 3: Run the sample##### If you have an installed MinGLE version, that library will be loaded# instead of the "../../src/.libs/mingle-parallel.so" and# "../../../mingle/src/.libs/mingle.so"# The following forces the usage of the development version of MinGLE# and MinGLE-parallelexport LD_LIBRARY_PATH="../../src/.libs/:../../../mingle/src/.libs/:$LD_LIBRARY_PATH"echoecho "================================================================================"echo "SVA: Started the X server(s). Now running the application..."echo "================================================================================"SESSIONID=1MASTER=`hostname`SLAVES=`expandnodes ${SVA_Allocate_Hosts}`echo "Allocated hosts = $SLAVES"echo "Master = $MASTER"# Save the DISPLAY variableOLDDISPLAY=$DISPLAY# Run slave appsexport DISPLAY=:0for n in $SLAVES; do echo "Running slave piece on $n" srun -N1 -w $n ${_PC_Executable} $SESSIONID 1 $n &done # Restore DISPLAY variableexport DISPLAY=$OLDDISPLAY# Restore the preload state as we may need it for running the app itself...if [ ${SVA_TurboVNC_Session:-0} -eq 1 ] ; then export LD_PRELOAD=${LD_PRELOAD_STATE}fiecho "Running master piece on $MASTER"${_PC_Executable} $SESSIONID $((SVA_Render_Count+1)) $MASTER $SLAVES##### JOB PHASE 4: Terminate the job. This is where your job is terminated. If you# have any special termination commands this is where you would# place them.##### Kill the Job[ -n $SLURM_JOBID ] && svaTerminateJobStep $SLURM_JOBID# Wait for everthing to terminatewait#MASTER=`hostname`#SLAVES="n13 n14"#${_PC_Executable} $@ $SESSIONID $MASTER $SLAVES
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -