move everything to local folder
This commit is contained in:
81
local/examples/jobs/matlab_script.sh
Executable file
81
local/examples/jobs/matlab_script.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
|
||||
#############################################################
|
||||
# This example produces a very simple plot and #
|
||||
# saves it as Matlab figure file and as PNG file #
|
||||
#############################################################
|
||||
|
||||
#############################################################
|
||||
# set qsub options #
|
||||
#############################################################
|
||||
# run in low.q
|
||||
#$ -l low
|
||||
|
||||
# request enough memory
|
||||
#$ -l h_vmem=8G,memory=8G,h_stack=8M
|
||||
|
||||
# request 1 matlab license.
|
||||
#$ -l matlab=1
|
||||
|
||||
# Name the job 'Matlab'
|
||||
#$ -N Matlab
|
||||
|
||||
# send e-mail after job has finished
|
||||
# use the -M option to define your e-mail address
|
||||
# #$ -M meine-email@example.org
|
||||
#$ -m e
|
||||
|
||||
# join stdout and stderr in one file
|
||||
#$ -j y
|
||||
|
||||
#############################################################
|
||||
# output hostname and date (comment out if not needed) #
|
||||
#############################################################
|
||||
echo "Runnning Matlab on host " `hostname`
|
||||
echo "Starting Matlab at " `date`
|
||||
|
||||
#############################################################
|
||||
# launch matlab #
|
||||
#############################################################
|
||||
|
||||
# run non-interactive Matlab session
|
||||
# use no display (-nodisplay)
|
||||
# don't show splash screen at startup (-nosplash)
|
||||
# don't start the matlab desktop (-nodesktop)
|
||||
# use software opengl (-softwareopengl)
|
||||
# only use single threaded computations (limit to use of 1 core, -singleCompThread)
|
||||
# execute all matlab commands between '<< END' and matching 'END'
|
||||
|
||||
# Don't forget to add 'exit' and 'END' after replacing
|
||||
# the commands with your own!
|
||||
|
||||
/opt/matlab/bin/matlab -nodisplay -nosplash -nodesktop -softwareopengl -singleCompThread << END
|
||||
|
||||
% get environment variable JOB_ID
|
||||
jobid=str2num(getenv('JOB_ID'));
|
||||
if isempty(jobid)
|
||||
jobid = 0;
|
||||
end
|
||||
|
||||
% create filenames for the figure
|
||||
filename=sprintf('matlab_figure_%d', jobid);
|
||||
|
||||
% create new empty figure and save figure handle
|
||||
fh = figure();
|
||||
|
||||
% draw plot
|
||||
plot(-pi:0.01:pi, sin(-pi:0.01:pi));
|
||||
|
||||
% save figure as matlab figure and PNG
|
||||
saveas(fh, filename, 'fig');
|
||||
saveas(fh, filename, 'png');
|
||||
|
||||
% EXIT MATLAB
|
||||
exit;
|
||||
|
||||
END
|
||||
|
||||
#############################################################
|
||||
# output date (comment out if not needed) #
|
||||
#############################################################
|
||||
echo "Matlab finnished at " `date`
|
||||
75
local/examples/jobs/periodic_sleeper.sh
Executable file
75
local/examples/jobs/periodic_sleeper.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# This job script takes a nap for 10 seconds (or paramter $2) every 30 minutes (or paramter $1)
|
||||
|
||||
# SGE options
|
||||
#$ -N PSleeper
|
||||
#$ -l scf=1M,mem=100M,h_vmem=100M
|
||||
#$ -q normal.q
|
||||
#$ -cwd
|
||||
|
||||
# process args
|
||||
case "$1" in
|
||||
-h)
|
||||
echo "usage: $0 [-h | [-d] [T] [nap]]"
|
||||
echo "periodically take a nap"
|
||||
echo ""
|
||||
echo "-h print this help and exit"
|
||||
echo "-d print debug info"
|
||||
echo "T take a nap every T minutes (default: 30)"
|
||||
echo "nap take a nap for nap seconds (default: 10)"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
debug=0
|
||||
terse="-terse"
|
||||
debug_flag=""
|
||||
do_echo=0
|
||||
T=30
|
||||
nap=10
|
||||
while (( "$#" )); do
|
||||
case "$1" in
|
||||
-d)
|
||||
debug=1
|
||||
terse=""
|
||||
debug_flag="-d"
|
||||
do_echo=1
|
||||
;;
|
||||
*)
|
||||
T=${1:-30}
|
||||
nap=${2:-10}
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# set other variables
|
||||
next=$(date -d "${T} minutes" +%Y%m%d%H%M)
|
||||
script=/opt/SGE/examples/jobs/periodic_sleeper.sh
|
||||
|
||||
# output some informations
|
||||
if [ ${debug} -eq 1 ]; then
|
||||
echo "T = ${T}, nap=${nap}"
|
||||
echo "next run at ${next} (YYYYMMDDhhmm)"
|
||||
echo "debug_flag = ${debug_flag}, do_echo = ${do_echo}"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# commands to run in Grid Engine
|
||||
/opt/SGE/examples/jobs/sleeper.sh ${nap} ${do_echo}
|
||||
|
||||
# re-submit script to execute in T minutes
|
||||
jobid=$(qsub ${terse} -a ${next} ${script} ${debug_flag} ${T} ${nap})
|
||||
exit_code=$?
|
||||
if [ ${debug} -eq 1 ]; then
|
||||
echo "${jobid}"
|
||||
fi
|
||||
if [ ${exit_code} -ne 0 ]; then
|
||||
if [ ${debug} -eq 1 ]; then
|
||||
echo "${jobid}"
|
||||
echo "Ups, something went wrong, check output!"
|
||||
fi
|
||||
exit ${exit_code}
|
||||
fi
|
||||
44
local/examples/jobs/show_available_cuda_devices.sh
Executable file
44
local/examples/jobs/show_available_cuda_devices.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
#############################################################
|
||||
# use tensorflow to show availabel GPU devices #
|
||||
# optional argument is the conda environment to use #
|
||||
# default is tf-gpu #
|
||||
#############################################################
|
||||
TF_ENV=${1:-tf-gpu}
|
||||
if [ ${TF_ENV} = "-h" ] ; then
|
||||
echo "Usage: $(basename $0) [tensor_flow_env]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#############################################################
|
||||
# set qsub options #
|
||||
#############################################################
|
||||
#$ -cwd
|
||||
#$ -N CUDAtest
|
||||
#$ -l memory=64G,h_vmem=64G
|
||||
|
||||
#############################################################
|
||||
# initialize conda #
|
||||
#############################################################
|
||||
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__conda_setup"
|
||||
else
|
||||
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
|
||||
. "/opt/anaconda3/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="/opt/anaconda3/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
# <<< conda initialize <<<
|
||||
|
||||
#############################################################
|
||||
# activate conda env ent call python commands #
|
||||
#############################################################
|
||||
conda activate ${TF_ENV}
|
||||
export TF_CPP_MIN_LOG_LEVEL=3
|
||||
export TF_FORCE_GPU_ALLOW_GROWTH=true
|
||||
echo "CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-''}."
|
||||
python3 -c "from tensorflow.python.client import device_lib; print(device_lib.list_local_devices())"
|
||||
conda deactivate
|
||||
37
local/examples/jobs/simple_conda_test.sh
Executable file
37
local/examples/jobs/simple_conda_test.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#! /bin/bash
|
||||
|
||||
#############################################################
|
||||
# This example show a list of availabel conda environments #
|
||||
#############################################################
|
||||
|
||||
#############################################################
|
||||
# set qsub options #
|
||||
#############################################################
|
||||
# run in low.q
|
||||
#$ -l low
|
||||
|
||||
# request enough memory
|
||||
# #$ -l h_vmem=8G,memory=8G,h_stack=8M
|
||||
|
||||
# Name the job 'Conda-Test'
|
||||
#$ -N Conda-Test
|
||||
|
||||
#############################################################
|
||||
# initialize conda #
|
||||
#############################################################
|
||||
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__conda_setup"
|
||||
else
|
||||
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
|
||||
. "/opt/anaconda3/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="/opt/anaconda3/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
|
||||
#############################################################
|
||||
# show conda environments #
|
||||
#############################################################
|
||||
conda env list
|
||||
Reference in New Issue
Block a user