add example scripts
This scripts are for testing and to show how to write your own gridengine scripts
This commit is contained in:
parent
097ccac7bd
commit
fd6c9867f2
81
examples/jobs/matlab_script.sh
Executable file
81
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`
|
44
examples/jobs/show_available_cuda_devices.sh
Executable file
44
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
examples/jobs/simple_conda_test.sh
Executable file
37
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
|
Loading…
Reference in New Issue
Block a user